As you know, Google Analytics allows you to define a campaign with marketing parameters at the end of a URL linking to your site. You can set things such as the name of the campaign, the medium, the source, etc.
The _setAllowAnchor method[http://code.google.com/apis/analytics/docs/gaJSApi.html#_gat.GA_Tracker…] in GA allows you indicate these parameters in the URL with a # symbol instead of the ? symbol that is normally used.
However, the documentation for this method is a little confusing, so I’d like to go over how to use it.
To enable the use of the # symbol for your GA campaigns we need to add one line into the middle of your existing GATC. Everyone’s GATC may look a little different, but everyone should have the lines below.
This change should happen on every page of your website.
The Campaign URLS
After making the above change to your GATC, you can still use the standard campaign tracking parameters. You do not need to change any of your existing campaigns. But you also get the option to use an alternate version of campaign tracking. In the alternate version, you are just replacing the ? with a #.
This standard method for campaign tracking uses a URL that looks like this:
The alternate method for campaign tracking uses a URL that looks like this:
The Example in the GA Documentation looks like this (This doesn’t work):
Four Examples in GA
Here is an example of 4 different variations and what you will see in Google Analytics as a result:
As you can see, when the # is used in place of the &, GA doesn’t seem to recognize it as a separator.
So there you have it. I hope it is fairly straight-forward.
Someone pointed out that I had overlooked a possible situation. What happens if your URL already contains a query parameter such as ?page=123, what then?
**If your original URL looks like this, then the # replaces the first ampersand.**
This URL: Front Page
Will provide this result:
And remember, campaign tracking doesn’t have to be cam-painful.