How to set a Tracking Code (s.campaign?) for an SEO visit | Community
Skip to main content
ddierking
Level 2
May 11, 2022
Solved

How to set a Tracking Code (s.campaign?) for an SEO visit

  • May 11, 2022
  • 2 replies
  • 2475 views

Trying to set a tracking code for guest when then come to our site from an SEO link.  Because SEO links do not contain tracking codes in the URL I am not sure how to set this.  

 

Any thoughts?

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jennifer_Dungan

You should be able to create code based on Referrer.. I assume you are using Adobe Launch (or whatever they call it now), and are using a Data Element with custom code?

Something like this should work (just the referrer part, I assume you already have code to detect and parse your campaign data already):

var referrer = _satellite.getVar('data-element-referrer');
// Where data-element-referrer is the name of your data element that gets the page's referrer value

OR

var referrer = window.document.referrer;
// If you want to just read the referrer directly with JS

customSEOCampaign = "";
if (referrer.indexOf('https://www.google.') > -1){
    customSEOCampaign = "SEO";
}

return customSEOCampaign;


Then use this Data Element in your custom eVar (or use custom code to set your s.campaign value based on presence of Campaign Tracking Codes or Referrer.



The other option is to use Processing Rules, or just create a Segment in your workspace.... There are many ways to go about this 🙂

2 replies

ddierking
ddierkingAuthor
Level 2
May 11, 2022

We are currently trying to write code that looks at the URL to see if it has a Tracking Code, if it does not the logic would be to check if the referring domain is Google (as an example) and then set Tracking Code "SEO".  We have had no luck with this.  Perhaps it is how we are writing the code? 

 

(we are trying to test its success in a new eVar, not V0)

Jennifer_Dungan
Community Advisor and Adobe Champion
Jennifer_DunganCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
May 11, 2022

You should be able to create code based on Referrer.. I assume you are using Adobe Launch (or whatever they call it now), and are using a Data Element with custom code?

Something like this should work (just the referrer part, I assume you already have code to detect and parse your campaign data already):

var referrer = _satellite.getVar('data-element-referrer');
// Where data-element-referrer is the name of your data element that gets the page's referrer value

OR

var referrer = window.document.referrer;
// If you want to just read the referrer directly with JS

customSEOCampaign = "";
if (referrer.indexOf('https://www.google.') > -1){
    customSEOCampaign = "SEO";
}

return customSEOCampaign;


Then use this Data Element in your custom eVar (or use custom code to set your s.campaign value based on presence of Campaign Tracking Codes or Referrer.



The other option is to use Processing Rules, or just create a Segment in your workspace.... There are many ways to go about this 🙂

ddierking
ddierkingAuthor
Level 2
May 19, 2022

Worked like a charm!  Thank you!

yuhuisg
Community Advisor
Community Advisor
May 12, 2022

I'm wondering why you would use this over Marketing Channels.

With Marketing Channels, you can have 2 channels: Natural Search and Paid Search. Paid Search should have conditions for both Tracking Codes and Search Engines, whereas Natural Search has conditions for Search Engines only. Then order both channels such that Natural Search is after Paid Search. Now, using the Marketing Channels dimension and Marketing Channel Instances metric, you can get hits from Paid Search vs Natural Search (SEO). Then you don't need to mess with Tracking Codes.

ddierking
ddierkingAuthor
Level 2
May 12, 2022

Hi,

Marketing Channels are great however you cannot reclassify them as the business changes.  If I use a SAINT classification I can create retroactive views of our data and create actionable rollups with little effort. Being able to do this and not having SEO and Direct bundled makes our back end tools communicate much easier. 
Additionally, in our business roughly 30% of our guest interact with multiple business areas within a single session.  Example, a guest comes in though a PPC link, leaves and comes back to our site from an SEO link. Because there is no tracking code in the second entrance the SEO session 'holds' the existing tracking code from the visit a few minutes before, thus taking the "credit" for the session and associated conversion.  To complicate this a bit more, in this example you cannot use a "last touch" attribution model because adobe process BOTH hits within the SINGLE session (but even after I set a tracking code on SEO "last touch" would still not work, I am just adding some fun details).  

yuhuisg
Community Advisor
Community Advisor
May 13, 2022

I don't quite agree with your opinion that Marketing Channels are great until the business changes, since the channels are usually unchanging, e.g. Natural Search will always be Natural Search, i.e. traffic from search engines' natural/organic search listings.

Having said that…

@jennifer_dungan's suggestion is probably the best approach for you, i.e. checking the referrer URL. But you'll have to replicate the logic for detecting search engines reliably. I emphasise reliably because some of your AA users who are familiar with AA may use AA's built-in Search Engine or related dimensions (or even Marketing Channels! 😁), and if they were to breakdown that data by your SEO tracking codes, they might find discrepancies that you'll need to explain.