Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics Site Search

I use following sample URL pattern to search pattern on my web site.

http://www.mysite.com/search/someword No query strings, just clean URL..

How can set this URL to google analytics site search system?

like image 365
Adam Right Avatar asked Nov 18 '11 22:11

Adam Right


People also ask

What is site search in Google Analytics?

See how users search your site. Site Search lets you understand the extent to which users took advantage of your site's search function, which search terms they entered, and how effectively the search results created deeper engagement with your site. In this article: Set up Site Search.

How do I search a specific site in Google Analytics?

The first thing you need to do is open up Google Analytics, and then go to the behavior tab. In the behavior tab, click on the site content, then content drilldown tab. Then, you simply need to click the search icon in the bar, and you will be greeted with analytics specific to that individual page/post.

Can Google Analytics track Google sites?

Linking your Google Analytics account to your Google SiteGo to your Google Site you would like to track with this ID. Click on the Settings icon by the Publish button. Select Analytics in the left-hand column of the Settings pop-up window. Paste your Google Analytics Measurement ID in the box to the right.


1 Answers

In theory, you should be able to create a profile filter to convert the URLs to use a query string. In practice, it turns out it's not possible, because Site Search gets processed before filters get processed.

Instead, what I've found that works is to just manipulate it in JavaScript so that you "fake" a query string directly from the browser.

Something like:

if(!location.pathname.match(/^\/search/)){
    _gaq.push(["_trackPageview"]);
}
else{
    _gaq.push(["_trackPageview", location.pathname.replace("/search/","/search?q=")]);
}

This would "fake" a query string with a key of q that you could then easily use the Site Search feature with.

like image 149
Yahel Avatar answered Sep 23 '22 09:09

Yahel