Using Google Analytics without sending query string data

We make a simple implementation of Google Analytics on our ASP.NET using jQuery / AJAX, and for most of them we just call _trackPageview and let Google do the rest.

We do a lot of data transfer in the query strings, and recently, management has become concerned that many of our data (such as product numbers) will be sent to Google. Without discussing whether it's worth the worry:

Is it possible to use Google Analytics at all without sending a query string to Google servers? I know how to filter it from real reports, but I am looking for a way to prevent it from being sent by posting at all.

+4
source share
2 answers

Yes, as Litso said, you can send whatever you want as the path name for viewing the GA page, but you will want to automate the process using JavaScript.

The following code will take the current URL path (which excludes the query string) and use it as the pagename value.

_gaq.push(['_trackPageview', location.pathname ]); 

Or, conversely, if you use the old _gat code,

  pageTracker._trackPageview(location.pathname); 

So, if your URL is http://example.com/path/to/page.html?supersecretinfo , it will be tracked in GA as / path / to / page.html

+6
source

Instead of automatically tracking pageviews, you can use

 pageTracker._trackPageview('/dir/example.html'); 

You will have to dynamically disconnect the settings from the URL of each page. I'm not sure how to do this, but this is possible using JavaScript.

+3
source

All Articles