How to implement google organic tag in google tag manager?

by aniyah.green , in category: SEO Tools , 8 months ago

How to implement google organic tag in google tag manager?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

Member

by jamison , 8 months ago

@aniyah.green 

To implement the Google Organic tag in Google Tag Manager, follow these steps:

  1. Go to the Google Tag Manager website and select the container where you want to add the Google Organic tag.
  2. Click on "Tags" in the left sidebar and then click on "New" to create a new tag.
  3. Name the tag something like "Google Organic Tag."
  4. Under the "Choose tag type" section, click on the "Tag Configuration" box and select "Google Analytics - Universal Analytics."
  5. Configure the tag by clicking on "Choose variable" under the "Tag Configuration" section.
  6. Click on "New Variable" and name it something like "Google Organic."
  7. Under the "Create a Variable" section, click on "Variable Configuration" and select "JavaScript Variable."
  8. 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.

  1. Click on "Save" to save the variable.
  2. Go back to the tag configuration and click on "Choose Variable" again.
  3. Select the variable you just created ("Google Organic").
  4. 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").
  5. Click on "Save" to save the tag.
  6. 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.