How to Install the Google Tag (gtag.js)
Updated Date:
Installing the Google Tag (gtag.js)
The Google tag is separate from the ClickSambo tracking codes:
ClickSambo codes analyze the visitors who arrive from your ads to detect suspicious clicks.
The Google tag (gtag.js) sends data to Google Analytics (visitor statistics) and Google Ads (conversion tracking and remarketing).
If you use Google Analytics or Google Ads conversion tracking, install both the ClickSambo codes and the Google tag.
Step 1: Get Your Google Tag Snippet
Google Analytics 4: go to Admin > Data collection and modification > Data streams, select your stream and open View tag instructions.
Google Ads: open the Google tag setup of your conversion action and choose to install the tag yourself.
Copy the full snippet. It looks like this, with your own tag ID instead of G-XXXXXXXXXX:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script> Step 2: Add the Google Tag to Your Website
The tag must be on every page of your website.
Open your website's main theme or header template.
Paste the snippet inside the
<head>section, ideally right after the opening<head>tag.Save and publish your changes.
Step 3: Verify the Installation
Realtime report: open the Realtime report in Google Analytics, visit your website in another tab and check that your visit appears.
Tag Assistant: open Google Tag Assistant, enter your website URL and check that the Google tag is found.
Important Considerations
Using Google Tag Manager? Don't add gtag.js to your code. Set up the Google tag inside Google Tag Manager instead. You can also install ClickSambo with Google Tag Manager.
Check Google's documentation: Google updates its products often, so follow the official Google Analytics and Google Ads guides for the latest steps.
Platform-specific steps: how to add code to the
<head>section depends on your website platform (for example WordPress, Shopify or Wix).