Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 2

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?

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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 🙂

View solution in original post

1 Reply

Avatar

Level 2

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)

Avatar

Correct answer by
Community Advisor

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 🙂

Avatar

Community Advisor

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.

Avatar

Level 2

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).  

Avatar

Community Advisor

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.

Avatar

Community Advisor

LOL, very true @yuhuisg... I helped provide code, how @ddierking uses that is up to them.

 

I will add a note of caution here... having "google" in the referrer may not all be search engine traffic... remember that the Google App, Google News, Google Showcase and other potential Google products, may use similar URL structures... 

 

This is why if you look at Referrer Types and Referring Domains, Google will appear under both Search Engine AND Other Websites... the variant is mapped to different groups based on a lot of different criteria. 

 

That said, you did mention that you are using a custom eVar for this (or maybe that was just while you were trying this out?) but if you do that, you have a little more wiggle room to use both the default Marketing Channels AND your Custom Tracking, and give yourself some room to tweak without flat out breaking something.....

 

I have something similar to detect traffic coming from webviews in identifiable mobile apps (based on reading some custom text that most apps write into their user agent strings). This way I can correlate the use of the FB app, or Twitter app, etc against the default tracking (it allows allows me to break down my Typed/Bookmarked traffic with a little more precision, since not all mobile apps provide referrer data - but at least now I can attribute some of that unknown bucket to something).