Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a website that uses hash # to identify URLs. So URLs might look like:


Obviously, "product name" is important here, and I need it to show up in Google Analytics, and by default, it does - the above URL shows up in GA as: somepage.aspx#productname

However, the tricky bit comes when I also need to add Google Analytics campaign parameters. They of course need to be added before the hash, so the above URL might need to look like this:


However, if I do this, the page will just show up in Google Analytics as "somepage.aspx". Is there a way to make it so that even when using campaign parameters, I can still keep the part of the URL after the hash in the Google Analytics page name?

share|improve this question
Have you tried doing it like this: www.mywebsite.com/somepage.aspx#productname?utm_source=source&utm_medium=medium – P1raten Feb 5 '14 at 9:00
Query strings won't work if they're after the hash. But, MrSponge's answer below seems to do the trick. – Ascendant Feb 10 '14 at 4:45
up vote 4 down vote accepted

Why not use # as campaign parameter instead?

See this from Google Analythics:

This method sets the # sign as the query string delimiter in campaign tracking. This option is set to false by default.

Conventional campaign tracking URLs use the question mark (?) to indicate the beginning of key/value pairs that make up the query. If you set this option to true, your campaign tracking URLs can use a pound (#) sign instead of the question mark (?) to indicate the beginning of the query string.

share|improve this answer
If I enable _setAllowAnchor, will "legacy" URLs which still use the question mark for Google Analytics campaign parameters still work as normal? – Ascendant Feb 10 '14 at 4:51
@Ascendant: Yes, this should still be the case. – MrSponge Feb 10 '14 at 10:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.