开发者

Google Analytics (Internet Marketing - Tracking website - Query Parameter)

开发者 https://www.devze.com 2023-03-17 06:39 出处:网络
If there is no query parameter in the url of search bar results and I want 开发者_StackOverflow社区to track inside google analytics what guests search inside Search bar on my website then I need to ad

If there is no query parameter in the url of search bar results and I want 开发者_StackOverflow社区to track inside google analytics what guests search inside Search bar on my website then I need to add the following code inside the GA tracking code:

pageTracker._trackPageview("/searchresults.html?q=$keyword"); 

but how to translate it into new version of tracking code? with gaq word.

Also whoever would be willing to answer please say if I have to change $keyword or keyword with anything else or can I type EXACTLY this?

Also please say where exactly, inside google analytics tracking code, do I need to paste the code line? Probably somewhere around word var but don't know where...


Simply use:

_gaq.push(['_trackPageview','/searchresults.html?q=$keyword']);

it can be anywhere in your page, it should replace the default

_gaq.push(['_trackPageview']);

call

You will need to have server side code (PHP, ASP, ...) fill in the value for $keyword.

Next, you will need to enable search term parsing in your GA Profile(s) settings.

Beware to use a parameter name ('q' here) that isn't used for other purpose in your site, elese every URL logged to GA and containing this parameter will be parsed as search query and the value will be considered as a keyword.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号