Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We currently use a hashbang for the portion of our site that generates dynamic content which can also be deep linked. Our analytics team wants to use utm params to track the referral traffic from social networks. We are using Universal Analytics (analytics.js) as well as GTM.

Will GA pick up the query parameters after the hashbang or does it always have to go before? For example:

example.com/#!/some/content?utm_source=foo&utm_campaign=bar
example.com?utm_source=foo&utm_campaign=bar/#!/some/content

In #1, I'm concerned that the utm params won't be recorded and in #2 the page will break or the url could be incorrectly written. How does GA pull in those parameters - location.search? regex?

Can I get away with using either?

share|improve this question
    
Have you already found a solution for this? I'm dealing with the exact same issue, where I don't see the utm tagging in GA. For example with this URL: vandebron.nl/#!/s/… –  Fred May 30 at 13:45

2 Answers 2

I dont think the GA will kick-in after #!

I guess (and correct if my speculation is wrong), that your #! site is using the front controller pattern (just like WordPress and its index.php).

In which case, can't you tweak your framework to move away from #! and towards something more friendlier? Your problem is that # generally indicates anchor tags within the page. So, anything which comes after the # is not interpreted separately.

share|improve this answer

I ran into this same issue at a previous company and it was a mess (one guy actually lost his job due to bad URLs being used for tracking paid search and no one understanding why GA showed different results than Kenshoo...).

You can come up with a custom workaround using JavaScript to inspect the URL query string to look for UTM params after a #! then rewrite the page that gets tracked.

If you decide to go the route of custom JavaScript to deal with it this may be useful. Here is the reference for setting the various UTM values on your own in code.

So without adding custom JavaScript or rewriting the system to remove the hashbangs, there really isn't a way to deal with this. Honestly though you should do whatever you can to move away from #! URLs.

share|improve this answer

Your Answer

 
discard

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.