#1
  1. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jul 2008
    Posts
    2
    Rep Power
    0

    Separating Google Analytics campaign tracking from HTML


    I'm having a little conundrum, and was wondering if any coders could help.

    From time to time we have certain features on our site we want to add campaign tracking to. I'd like to make a reusable, scalable javascript function, so we don't have to pop the campaign tracking in and out of our inline code.

    For ease, let's say that I want to ad a new in-house ad that links to /subscribe/, and we'll track this specific link element as a campaign click (there may be links to /subscribe/ elsewhere.)


    The method google recommends is to build a url with the Urchin tracking variables on it. For instance, /subscribe/?utm_source=SOURCE&utm_medium=MEDIUM&utm_content=C ONTENT&utm_campaign=CAMPAIGN

    The problem I have with setting this as the static href of any link is that Google's very own crawler will see this new page as a unique URL, so now I have "duplicate content" in Google's eyes AND I'm missing out on the inbound links for xyz/subscribe/ ; multiply this by every link or campaign I decide to do and it gets sticky.

    If you don't believe me, look at the approx 2.4 million matches for a google search of "inurl:utm_source"

    What I've been doing to rememdy the situation for just this one link is building a JS function that attaches an onclick event to the a object (by ID). Then, when the user clicks, it adds the campaign variables to the url. This way, Google still crawls /subscribe/, but the user loads /subscribe/?utm_source=etc...

    It's worked brilliantly so far but I am trying to model a scalable way to do this for any of my links. I don't want to have to go and edit that JS file every time, and that would be bad coding practice. However, I want to keep the JS onclick events out of the inline code, too. If we start adding tracking variables to every link on our page (sometimes up to the golden 100) then our code is going to become hard to maintain and full of duplicate calls. It's the same reason you would keep an external stylesheet.

    I was thinking of modelling something like this:
    <a href="/subscribe/" class="subscribe">Subscribe Now</a>

    I could build a JS function that would attach the onclick event to every link, with the same source (our site) and medium (inline link), with the "content" being the second classname. Microformats use classnames with semantic meaning, so I don't think it's terrible practice. The problem here is that sometimes we use classnames for other purposes. I can't exactly mark it. I would love to set a dummy attribute like <a href="/subscribe/" utm_source="topadspace">, but that's not only invalid XHTML, but would probably not be recognized as a valid DOM property that I could extract in my function. I need a way to pass the "content" variable to the onclick event, though. And like I said before, I don't want to attach onclick="trackingfunction('contentname')" directly in each URL.

    Any suggestions? Has anyone come up with any other models for separating the campaign click and still controlling it element-by-element?

    Thanks,
    Danielle Reisch
    Last edited by dreisch; Jul 29th, 2008 at 02:31 PM.
  2. #2
  3. SEO Consultant
    SEO Chat Genius (4000 - 4499 posts)

    Join Date
    Jul 2004
    Location
    Minneapolis, MN, USA
    Posts
    4,322
    Rep Power
    1284
    I might not have understood your requirement fully but it sounds very much like Conversion Goals in your analytics would work.

    You just set up a conversion goal and the funnel that you want it to take and it will track the performance of that section and tell you how well it is performing.

    This is scaleable because you have an easy method of adding ammending etc and you don't have to touch any code - you let Google do the hard work for you.
  4. #3
  5. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jul 2008
    Posts
    2
    Rep Power
    0
    Originally Posted by tstolber
    I might not have understood your requirement fully but it sounds very much like Conversion Goals in your analytics would work.

    You just set up a conversion goal and the funnel that you want it to take and it will track the performance of that section and tell you how well it is performing.

    This is scaleable because you have an easy method of adding ammending etc and you don't have to touch any code - you let Google do the hard work for you.
    The reason conversions won't work is because we don't have a necessary goal in mind (we're not just talking subscribe, but clicks to articles and other sections of our site as well), and we'd like to use this on many elements, some on the same page, sometimes A/B. For instance, we might have a link to our article in a "featured headlines" area, but we also link to it from a module with the "most popular headlines." And even though the Medium is a text link and the source is our own site, we want to put a different "content" marker. Or maybe the taxonomy will be a little different, but the main difference being that different elements on the *same* page should be tracked differently, while having the same href.
  6. #4
  7. SEO Consultant
    SEO Chat Genius (4000 - 4499 posts)

    Join Date
    Jul 2004
    Location
    Minneapolis, MN, USA
    Posts
    4,322
    Rep Power
    1284
    OK, I understand a little more about this now.

    Do you still want this logged in Google Analytics or do you just want to know how well those links are performing.

    Google Analytics Link Overlay shows the percentage of clicks for a particular link on a page. You can filter the time, location and other things and you know where the text link is going so this gives you some useful information.

    If you just want to know how specific links are performing you can indeed make an on click event and log it in text files. I have done this before on E-commerce sites where transaction logging is very important. This was mainly to help spot and prevent fraud rather than track but it has the same effect.

Similar Threads

  1. Replies: 3
    Last Post: Apr 17th, 2007, 11:02 AM
  2. Questions about Google Analytics
    By KAMaster in forum Analytics Analysis
    Replies: 5
    Last Post: Apr 16th, 2007, 09:40 PM
  3. Google tracking search clicks (privacy issue)
    By vaibhavs in forum Google Optimization
    Replies: 6
    Last Post: Apr 4th, 2006, 11:26 AM
  4. Google PageRank Outage On Google Toolbar
    By SeoPool in forum Google Optimization
    Replies: 0
    Last Post: Jun 1st, 2005, 12:38 AM
  5. Google and click through tracking
    By Flamewine in forum Google Optimization
    Replies: 2
    Last Post: Feb 24th, 2003, 07:19 AM

IMN logo majestic logo threadwatch logo seochat tools logo