jeffreynolte
jeffreynolte

Reputation: 3779

Setting Google Analytics to use custom Source Key for Campaigns

I have a campaign I will am looking to track the source for in Google Analytics and I have a URL structure setup with the respective advertising outlets and the code listed below to map the src parameter to the URI structure I have setup but for some reason I am not seeing the records in the Google Analytics admin. The Snippet I am using is from the HTML5Boilerplate and the documentation for the Google Analytics _setCampSourceKey is here.

URI STRUCTURE

sample-uri.com/enter-to-win/?src=campaignSource

GOOGLE ANALYTICS ON PAGE

var _gaq=[['_setAccount','XX-XXXXX-X'],['_setCampSourceKey', 'src'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
  g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
  s.parentNode.insertBefore(g,s)}(document,'script'));

Does this look like it is setup correctly? Thank you in advance

JN

Upvotes: 0

Views: 335

Answers (2)

Yahel
Yahel

Reputation: 37305

Yes, this is setup correctly. Just try it out. If you view your cookies, you'll see the value you put in src is documented in the __utmz cookie, in the utmcsr subvalue:

__utmz=163456314.1320168230.1.1.utmcsr=campaignSource|utmccn=(not%20set)|utmcmd=(not%20set);

That value should appear in your "Source" report in your "Traffic Sources" section in Google Analytics. It might take up to 24 hours for those values to appear, though.

Upvotes: 1

daveyfaherty
daveyfaherty

Reputation: 4613

See where it says "XX-XXXXX-X" that should be your google analytics tracker id for your website. It all relies on that.

Login to analytics, go to analytics settigns, and you'll see the code you need to sue. It starts with UA for all of mine.

Upvotes: 0

Related Questions