Google Tag Manager recipe
Install ReTarget.gg on any site via Google Tag Manager in under a minute. One Custom HTML tag, one trigger, done.
If you manage your site's tags through Google Tag Manager, you can install ReTarget.gg without touching a single line of source code. One Custom HTML tag. One All-Pages trigger. Publish.
Install
Open GTM → Tags → New → Custom HTML
In your GTM workspace, create a new tag. Pick Custom HTML as the tag type.
Paste the snippet
This is the exact tag the dashboard generates. The guard on
data-websitemakes it safe to fire on every page: the widget still loads exactly once per document, even after SPA route changes or GTM refire.GTM Custom HTML<script> (function () { if (document.querySelector('script[data-website="{{WEBSITE_KEY}}"]')) return; var s = document.createElement('script'); s.src = 'https://cdn.retarget.gg/widget.js'; s.async = true; s.setAttribute('data-pub', '{{PUBLIC_KEY}}'); s.setAttribute('data-website', '{{WEBSITE_KEY}}'); s.setAttribute('data-api', 'https://api.retarget.gg'); (document.head || document.documentElement).appendChild(s); })(); </script>Signed in?
If you're logged into the dashboard, the snippet above already shows your real
data-pubanddata-websitevalues. Copy it as-is: no placeholder substitution needed.Set the trigger to All Pages
Under Triggering, pick All Pages (the built-in page-view trigger). Don't add a DOM-Ready or Window-Loaded trigger: the widget's guard handles the ordering.
Save → Submit → Publish
Name the tag something like
ReTarget.gg widget. Click Save, then Submit your workspace as a new container version. Publish.
Verify
Open your site in a new tab with DevTools open:
Network tab → filter for 'widget.js'
You should see a
200 OKfromhttps://cdn.retarget.gg/widget.js.Filter for 'api.retarget.gg'
A
GET /v1/decisionshould fire with a200response. Blocked visitors will see the overlay; allowed visitors see nothing (and a204 No Contentsnippet-pingconfirms the widget is alive).Preview mode (optional)
In GTM, click Preview, open your site in the Tag Assistant flow, and confirm the
ReTarget.gg widgettag shows as Fired on the first page view.
SPA / route-change sites
On SPAs the Custom HTML tag may refire when the History trigger fires. The querySelector('script[data-website="..."]') guard at the top of the snippet prevents a duplicate load: the widget runs exactly once per document, as designed.
Using a different container for the section widget
If you're installing the inline section widget instead of the default popup overlay, the tag is the same pattern: just swap the script URL and add data-container:
<script>
(function () {
if (document.querySelector('script[data-website="{{WEBSITE_KEY}}"]')) return;
var s = document.createElement('script');
s.src = 'https://cdn.retarget.gg/widget-section.js';
s.async = true;
s.setAttribute('data-pub', '{{PUBLIC_KEY}}');
s.setAttribute('data-website', '{{WEBSITE_KEY}}');
s.setAttribute('data-api', 'https://api.retarget.gg');
s.setAttribute('data-container', 'retarget-ads');
(document.head || document.documentElement).appendChild(s);
})();
</script>You still need a <div id="retarget-ads"></div> somewhere in your page source: the widget mounts into the element by id. See Section widget integration for placement tips.
Troubleshooting
Tag fires but nothing loads
The most common cause is an origin mismatch: your site's domain isn't registered on the website in the dashboard. Check the browser console for [AF] decision failed · check domain + CORS. Add the correct domain under Websites → your site → Domain.
Popup never appears
Either your geo rules allow the current country (that's a success: the widget is silent), or the /v1/decision request is failing. Open Network, look at the response. If allowed: true, it's behaving correctly. See Debugging for the full decision tree.
Related
Publisher
Geo Popup & Decline Popup overview
The product framing for the install you just read.
Advertiser
CPC, CPA, eCPM in one auction
The demand side of the network — useful context even for publishers.
Essays
Long-form strategy
How others think about geo-blocking, KYC declines, and bid models.
Need help with setup?
Send us your website stack, target regions, and whether you are installing Geo Popup or Decline Popup.