Hashing it Out: Referral Tracking


Using the hash mark (#) instead of the question mark (?)


Have you ever wanted to track the visits to your site from a specific link, but worried about the negative implications of using query parameters in the URL? (I know, it’s kept me up late at night too.) We recently talked with Mike Plummer, a Seattle-based web analyst at POP, about this topic and he gave us some ideas to chew on – thanks Mike!

Using tracking parameters in the URL is a great way to track visits from links on other sites, but it raises a couple of thorny issues: duplicate content and (possibly) devaluing the links to your site if they are perceived to be paid links. Let’s look at the first issue – duplicate content.

Duplicate Content (Duplicate Content)

Here’s a hypothetical example: Let’s say LunaMetrics is running a special promotion of giving away a lifetime supply of ice cream to all new clients. In fact, this (hypothetical) promotion is such a big hit, web analyst guru and all-around great guy Avinash Kaushik decides to blog about it and post links to our homepage.

Of course, being the analysts we are, we want to track the visits from those links, so we ask Avinash to add the following tracking parameters to the links:


Things are going great – we are able to segment the traffic to just the visits from those specific links, and see that visits from Avinash have an 87% conversion rate! In fact, readers of Avinash’s blog are so excited about our promotion (and they love ice cream so much) they all start bookmarking our homepage and linking to it on their own blogs and websites. The only problem is that they bookmark and link to the URL with the tracking parameters (who can blame them – they just copy and paste the address from the browser).

The problem is that the search engines view the URL with the tracking parameters as a different page than our homepage URL without the parameters. So the value of all the links to the URL with the parameters doesn’t count toward our homepage at all. (And we all know how important links are when it comes to ranking higher in the search results, right?)

What are we to do?

Anchors Away!

Instead of using a question mark (?) in the query parameter, set it off with the hash mark (#). Of course, you’ll want to modify your Google Analytics Tracking Code with pageTracker._setAllowAnchor(true); to track the parameters after the hash mark. Google’s documentation on this feature is a little confusing, so we’ll be covering the proper usage in a short follow-up post later in the week. (Update: As promised, here’s the follow-up post – “Campaign Tracking with _setAllowAnchor)

The great thing about this method is that when Google sees a URL with a hash mark, it ignores everything after the hash. So…






are all the same page in the eyes of Google. That means that when someone links to www.lunametrics.com/#utm_source=avinash&utm_medium=blog&utm_campaign=icecream it will be the same as linking to www.lunametrics.com as far as Google is concerned.

The Issue of Paid Links

Here’s what Google says about paid links:

Google and most other search engines use links to determine reputation. A site’s ranking in Google search results is partly based on analysis of those sites that link to it. Link-based analysis is an extremely useful way of measuring a site’s value, and has greatly improved the quality of web search. Both the quantity and, more importantly, the quality of links count towards this rating.

They go on to say that some SEOs and webmasters have participated in buying and selling links that pass PageRank in an effort to rank higher. That is in direct violation of their webmaster guidelines, and they have been getting more aggressive in detecting these paid links and devaluing them. (It’s only fair to include that Google isn’t against all paid links – as long as they are designated as being paid.)

In the last paragraph, they say “Google works hard to ensure that it fully discounts links intended to manipulate search engine results, such as excessive link exchanges and purchased links that pass PageRank.”

Let me put on my aluminum-foil hat for all you conspiracy theorists out there. There are some that believe that if Google sees campaign parameters in a URL that it’s a signal for a paid link. If that’s the case, then links to your site that include campaign parameters may not pass any PageRank to your page.

But there are certainly cases (like our ice cream promotion example) where we aren’t paying for the link, but want to be able to track it. Again, using the hash mark (#) instead of the question mark (?) should accomplish this.

There you have it. Now, who wants ice cream?

Jim Gianoglio is a Manager for the Analytics & Insight department. He works with implementation, analysis and training of Google Analytics and Google Tag Manager. Before focusing on analytics, he led the SEO campaigns of Fortune 500 companies in the insurance, retail and CPG industries. Things you didn’t know about Jim: he’s biked from Pittsburgh to Washington DC in 41 hours, roasts coffee beans and has done voiceovers for TV commercials.

  • Those hash marks would be referred to as Fragment Identifiers. And yes, everything after the # is ignored. If you are setting up a list of links that use Fragment Identifiers all leading to the same reference, use rel=”nofollow” on all but the primary reference point (that without the #). No need to have all those duplicate links sitting there getting counted in the overall scheme of things.

    Be Specific, Use Fragment Identifiers

  • Cybernaut SEO

    You can always use cligs to track your link building effort. Check out this link; the post is about tracking your link building with Cligs.

  • Nice post – do you have any evidence to support your second assertion? That tracking paramaters after hashmarks won’t be classed as paid links? This makes little sense as people have been using hashmarks to tracking affiliate campaigns for quite sometime, I’d imagine Google is on to discounting this technique.

    Is there a way to reassign these paramaters to the correct fields using GA filters?

  • Jim

    Thanks for the comment pageoneresults – also, that’s a good thread on the Webmaster World forum that you linked to (lots of good info).

    However, you say “No need to have all those duplicate links sitting there getting counted in the overall scheme of things.” Why would you not want more links to your site? Are you referring to internal links on your own site that have the tracking parameters? What do you see as the drawbacks of having “duplicate links”? (By duplicate links I assume you mean multiple links to the same page with various tracking parameters).

  • Ah it seems you can rewrite the data with filters… very interesting =)

  • @Cybernaut – Whilst that might be a good resource it kind of misses the point here – the objective is to port the data into Analytics to cross referrence with other information.


  • Jim

    @Cybernaut – I also use cligs (and bitly and a few others) to track some links, but DangerMouse hit the nail on the head – it’s about getting more data after the click through.

    @DangerMouse – thanks for holding my feet to the fire and demanding proof (you deserve no less!) I’m setting up a test to try to answer the question of whether or not links with campaign parameters (either with the ? or the #) are discounted. I’d love to hear your feedback if you have direct experience.

  • Sorry Jim – I hope I didn’t sound too demanding 🙂

    I’m afraid I have no experience, and am really just guessing. Personally I think this is an incredibly crude method of detecting paid links on Google’s part, but unfortunately as I feel they are probably clutching at straws to accurately detect paid links I suspect this really is an option.

    Either way, solving the potential duplicate content problem alone, without cloaking, makes this technique worth while imo.

    I’m looking foward to your post later in the week that discusses correct hash tag tracking.


  • Don’t know about you but i’d give Google a little bit more credit for identifying paid links.
    I think that when he will see his own parameters in a link he will know what they are about.

    However Jim, this article is a total hit for me. I was looking for a good hash tracking resource for a long time. Now i really get it how it works. 🙂 And be sure not only Avinash will point that link for free ice cream. 🙂 By the way, when is the ice cream party? 🙂

  • Tim H

    Nice work Jim,

    Allaedin @ E-Nor blogged about this concept few days ago


  • BradleyT

    Nice post. Looks like a good way to individually track both an image and a text link that go to the same page or even a nav link vs. link in content (without having to use the onclick pagetracker event thing/whatever it’s called in GA).


    Isn’t that still two different links; one with the trailing slash and one without?

  • Cybernaut SEO

    @DangerMouse, @Jim, Thanks for the education guys. I look forward to reading the follow up post on the proper usage Jim.

  • Jim

    @BradleyT – Your eyes are better than mine! You are correct about the two different links (with the trailing slash and without). Fortunately, we have a rewrite rule set up to always add the trailing slash (and of course, it uses a 301 redirect). Good catch 😉

  • Think

    Should this work on top content report as well?

    I mean, if i have setallowlinker = true
    and i have published a link such as – mysite.com/promotion#test

    Would the phrase test appear on content report?
    Would google as a search engine will consider this link as mysite.com/promotion ?

  • DangerMouse

    @Think – Unfortunately I don’t think so; I think this is a direct replacement for campaign tracking rather than a method of tracking anchors.


Contact Us.

Follow Us




We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187