Solved

How can I track organic traffic from Google Search?

  • 29 March 2022
  • 5 replies
  • 2199 views

Badge

Hi everyone!
 

Im  trying to track users on my website that come from Organic Google Search, those traffic that are not paid ads, just people who find our site searching a word in google.

 

¿What kind of filters do I have to add in my chart?

 

¿UTM Source? ¿Referrer Domain? ¿UTM Campaign?

 

 

icon

Best answer by Saish Redkar 29 March 2022, 16:29

View original

5 replies

Userlevel 7
Badge +10

Hey @IamAlexander 

If you are using the JS SDK, the simplest way will be to use the includeReferrer option which will capture the the referrer and referring_domain. So your event segmentation chart with a filter like referring_domain = ‘Google’ will help you identify your organic google search visitors.

Here are a couple of posts for your reference

 

Hope this helps.

Userlevel 4
Badge +8

Hey @IamAlexander!

 

Just wanted to share how we navigate this. We use the JS SDK and GTM. In GTM, we run custom javascript to define Medium and Source so it aligns more closely with GA’s attribution. 

Below is the JS for Medium. It first looks at the URL to see if utm_medium is present. If it is, we will use that value. If it’s not present, we will look at the referrer. If the referrer is a major search engine, we will use “organic” for the Medium. Otherwise, we use null. 

function() {


function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);

return results === null ? undefined : decodeURIComponent(results[1].replace(/\+/g, " "));
}
if (getParameterByName('utm_medium')!=undefined) {
return getParameterByName('utm_medium');
} else if ( {{Referrer}} == "https://www.google.com/" || {{Referrer}} == "https://www.bing.com/" || {{Referrer}} == "https://search.yahoo.com/") {
return "organic"
} else {
return "(none)";

}
}

 

We do something similar for Source. If utm_source is not in the URL and the referrer is not a major search engine, we use Direct.

function() {
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);

return results === null ? undefined : decodeURIComponent(results[1].replace(/\+/g, " "));
}


if (getParameterByName('utm_source')!=undefined) {
return getParameterByName('utm_source');
} else if ( {{Referrer}} == "https://www.google.com/") {
return "google"
} else if ( {{Referrer}} == "https://www.bing.com/") {
return "bing"
} else if ( {{Referrer}} == "https://search.yahoo.com/") {
return "yahoo"
} else {
return "direct";

}
}

 

Badge

@SheenaGreen 

 

This looks really helpful. Sorry to hijack the thread and ask a dumb question but how is `getParameterByName` in your setup?

 

...

function() {


function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);

return results === null ? undefined : decodeURIComponent(results[1].replace(/\+/g, " "));
}
if (getParameterByName('utm_medium')!=undefined) {
return getParameterByName('utm_medium');
} else if ( {{Referrer}} == "https://www.google.com/" || {{Referrer}} == "https://www.bing.com/" || {{Referrer}} == "https://search.yahoo.com/") {
return "organic"
} else {
return "(none)";

}
}

 

 

 

Hi all!

 

I have a f/u question from the original ticket.

Is it also possible to track users came from an organic search engine, grouping by certain keywords they used for the search?

 

Is there a list of Search Engine URLs that replicates Google Analytics system defined rules? Also be nice if there was an ‘official’ Amplitude code snippet we could use to make the switch over from GA easier.

Reply