I just started using Google analytics for my website. I found that, enabling site search for a site is very easy as mentioned below,
But my site doesn't have the search term in the query string, instead it is part of the url as mentioned below,
https://mydomian.net/search#q=boxtest18
for some internal reason i cannot modify the code to append search term as querystring to url.
This article explained how to configure site search in GA, if Site Search Term Is Present in the URL: NOT As Query Parameter (Single Term).
When i tried, it doesn't seem working.
Below is my filter configuration.
What i'm doing wrong here?
Can i use the filter for this kind of url?
Is my regular expression correct?
Help me out here.
After digging into Google analytics and Google tag manager i found the solution. Solution was very easy in my case.
For every search, search term was updating in the url fragment. In the below case, i searched for boxtest18
and url updated like below.
https://mydomian.net/search#q=boxtest18
For this, i had crerated a Tag in Google tag manager and triggered it on history change event. That resovled my problem.
Here are the steps.
In google tag manager i have added new tag and filled highlighted info.
For the new tag i have created the triggering event as shown below.
And make sure you have the tracking code script and Google tag manager script in your web page. That's it. Hope it helps someone.