2

My company's search engine generates a hash/pound sign (#) instead of a question mark for search queries: Search.htm#search- followed by exactly the user's input string.

http://www.example.com/productVersion/content/Search.htm#search-users search terms here

As you can see, it's clearly not a key-value query pair.

For the Query parameter setting in GA, I've tried various forms of #search-, search-, and just search, but GA really seems to key off the URL query parameter (a question mark).

What can I do? I'm using analytics.js, not ga.js, so please don't try pushing _setAllowAnchor().

1

GA by default excludes anything after a fragment, but if you wanted to include that into your page reports, or other reports, you would need to overwrite the page parameter, like this;

var newPath = document.location.pathname + document.location.search + document.location.hash;
ga('send', 'pageview', {'page':newPath});
  • That more or less did the trick. I modified it a bit to rewrite the hash into a query and send that back instead. Thanks for the help! – Mike K. Mar 3 '16 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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