AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
5.9K members online now
5.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

How to track search queries when search engine uses hash instead of question mark?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

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

 

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 Expert replyverified_user

Re: How to track search queries when search engine uses hash instead of question mark?

Top Contributor
# 2
Top Contributor
Hi Mike,

there are multiple options on how to proceed.

Basic overview:
1) override the default page dimension by adding the hash part in the URI - once this is set use a view filter to extract all after #search-(.*) and use this object as the output for site search term field
2) overwrite the default page dimension prior to sending data to GA - so #search- becomes ?search=searchTerm - this new URI needs to be sent to GA as the page dimension

Some more details can be found here - http://www.simoahava.com/analytics/fix-ga-site-search-google-tag-manager/

Kind regards,
Zorin
Web analyst @ escapestudio.net