Use tags for 3rd party scripts

Contributors

@belovinovgmail-com


Business Benefits

Track user behavior on third-party platforms.


Go to your GTM Dashboard and click Tags.

This will show all the tags you have created or blank if you have not created any.

Click on the New button, then the Tag Configuration icon. Go through the list of built-in tags that will be displayed.

Scroll through thoroughly to see if the 3rd party platform you need is on the list. Use a built-in tag if available, because they are already optimized and pre-configured for GTM.

Click on the 3rd party platform you need from the built-in tags provided in the list.

This will prompt a pop-up that requests your Tag ID, Pixel ID, or Site ID, from your vendor. This could be a platform like Hotjar, Twitter, or LinkedIn. If your 3rd party platform does not have a built-in tag in the list, choose Custom HTML.

Copy and paste your HTML or JavaScript tracking code from the 3rd party vendor into the text box.

The 3rd party vendor should provide you with the tracking code, or guide you on how to generate it on their platform. If you do not know how to get your tracking code, contact your vendor support and ask for more help.

Set up your trigger by clicking on the icon and select the only built-in trigger, All Pages.

Triggers are responsible for sending a hit to your 3rd party platform. They answer the question of When do you want to send a hit? Generally, 3rd party scripts will go on all pages. However, GTM allows to create your own trigger if the default All Pages will limit your tracking goals.

To set up your own trigger, click on the + sign in the top right corner of the page. The All pages trigger will alert your 3rd Party platform every single time someone loads any page of your site, or any other track type you may have set up.

Rename your new 3rd party tag and click Save.

As a rule of thumb, name your tags according to the tag type you just created and track type. For example, you can name a Hotjar tag as HJ - Page View. Naming your tags according to tag type and track type will help you distinguish them from your tag list. Tags are listed in alphabetical order.

Test everything in the Preview mode. Click on the Preview button, on your GTM Dashboard, in the top right corner.

  • Enter the URL with http:// or http:// at the beginning and click on the Start button.
  • Your page will be loaded in a new window with a Debugger connected pop-up, in the bottom right corner of the website. It must say connected to work.
  • If the debugger is not showing connected, make sure the pop-up isn’t being blocked by your browser, that the correct GTM container is installed on your website, and you’re previewing the correct container. Or refresh the Tag Assistant tab and then click Start to reconnect to your website.
  • Click on the Web Assistant tab and click Continue. In the top left corner of the Tag Assistant tab, you will see Connected above the website URL.
  • On the left-hand side, you will see the pages that you’ve loaded while using the preview mode.
  • You can also see the triggers associated with the page. This includes built-in triggers, as well as any other 3rd party triggers you’ve configured.

Verify your tag by checking on your vendor dashboard to see if the hit is correctly captured.

Verification is necessary to avoid mix up. Especially when working with multiple scripts. This involves checking to see that the hit is fired to your vendor correctly. It is possible that the tag is only working in GTM and the hit is not being received by your vendor.

Publish your new tag by clicking on Submit. Enter the details and click Publish.

Publishing makes your new 3rd party tag go live and capture all users. Without publishing, the tag will only be live on your computer.

Last edited by @hesh_fekry 2023-11-14T11:10:24Z