@aniyah.green
To implement the Google Organic tag in Google Tag Manager, follow these steps:
- Go to the Google Tag Manager website and select the container where you want to add the Google Organic tag.
- Click on "Tags" in the left sidebar and then click on "New" to create a new tag.
- Name the tag something like "Google Organic Tag."
- Under the "Choose tag type" section, click on the "Tag Configuration" box and select "Google Analytics - Universal Analytics."
- Configure the tag by clicking on "Choose variable" under the "Tag Configuration" section.
- Click on "New Variable" and name it something like "Google Organic."
- Under the "Create a Variable" section, click on "Variable Configuration" and select "JavaScript Variable."
- Enter the following code in the "JavaScript Variable" box:
1
2
3
4
5
|
function() {
var referringSource = document.referrer;
var googleOrganic = /google/ig.test(referringSource) && /organic/ig.test(referringSource);
return googleOrganic ? 'Yes' : 'No';
}
|
This code checks if the referrer is Google and if it is an organic search.
- Click on "Save" to save the variable.
- Go back to the tag configuration and click on "Choose Variable" again.
- Select the variable you just created ("Google Organic").
- Under the "Triggering" section, click on "Choose a trigger" and select the trigger that you want to associate with the Google Organic tag (for example, "All Pages").
- Click on "Save" to save the tag.
- Finally, click on "Submit" in the top right corner to publish the changes to your container.
Now, the Google Organic tag will fire whenever the associated trigger is activated, and the data will be sent to Google Analytics.