File DA-030 View as Markdown
Google Tag Manager
With Google Tag Manager on your site, Double Agent pushes its verdict into the dataLayer. You can then use da_class in any trigger, for example to stop Google Ads tags from firing for bots.
Where the script goes
Put the Double Agent script in your site's <head> when you can (see Script tag). It then loads before GTM and before your ad tags, so the verdict is ready sooner. Use GTM to load it only when you cannot edit the <head>:
- In GTM, go to Tags › New › Tag configuration › Custom HTML.
- Paste the snippet from Script tag.
- Set the trigger to Initialization - All Pages, save and publish.
Either way, the push below works the same.
What GTM gets
dataLayer.push({
event: 'da_classified',
da_class, da_agent, da_score, da_bucket, da_rec, da_verified, da_behavior, da_behavior_risk, da_authorization,
});
It is pushed once per session, after the GTM container has loaded and only with analytics consent. Field values: Verdict.
Use the fields in triggers
- Go to Variables › User-defined variables › New › Data Layer Variable. Set the name to
da_class. Save it asDA class. Do the same forda_agentif you need it. - Create a trigger: Triggers › New › Custom Event, event name
da_classified. Tags that need the verdict fire on this trigger. - To keep bots out of a Google Ads tag, open the trigger that fires it (for example your purchase event), choose Some Custom Events and add the condition
DA classdoes not equalbot. GTM remembersda_classfor the rest of the page, so later events can read it.
Double Agent already holds back Google Ads conversions sent through gtag() for confident bots. The trigger condition covers Ads tags that GTM fires itself. See Meta, TikTok and Google Ads.
Check it worked
Open GTM's Preview mode on your site. In Tag Assistant you should see a da_classified event, and the Variables tab shows DA class with a value such as human.
Next: GA4 for reports, or Meta, TikTok and Google Ads for conversion hold-back.