How would I go about preventing the tracking of hash path changes within google analytics while using the jquery address plugin?
original URL:
/?watch
When moving sliders on the page, address bar is appended:
/?watch#/204;276
Within analytics I'm seeing it tracked as unique page views like so:
/?watch/204;276
I'm just wanting it to be tracked as:
/?watch
Help much appreciated.
You could use a custom search and replace filter with a regular expression in the search string.
Before setting up any filters, make a "master" profile in GA that contains unfiltered data. That way if your filter affects your data negatively, you have all your data unfiltered and backed up.
The regular expression I used is ^/\?watch[/0-9;]+ You can test it at RegExPlanet. I didn't put the hash (#) symbol in the regex because, according to your question, GA is not tracking it in the request URI.
Related
I am using Google Analytics and would like to see how users interact with my site, mainly what internal links they are clicking and from where.
One approach I've found is to add queries to my links like so ?ref=sidebar or ?ref=featured
Another approach is to use Event Tracking _gaq.push(['_trackEvent', 'Article', 'Click', 'Sidebar']);
I am wondering: Is there any reason to use one approach over the other? I know Event Tracking can be used to capture Javascript events, which queries cannot. But most sites I've seen also uses Event Tracking on their links, instead of simply adding a query string. Why is that?
Query Strings make different unique urls. So if you add query strings to your pages the pages report will show multiple entries for (basically) the same url depending on how people got there, e.g.:
subsite.html
subsite.html?ref=sidebar
subsite.html?ref=featured
each with it's own pageview count and other metrics.
Usually you do not want this. Event tracking is better since it does not blow up the url count (there might be be even better ways, especially if you upgrade to Universal Analytics and use custom dimensions).
General setting
I have a website, which uses regular and encrypted urls. Now I want to track the pageviews or all pages the same way.
I have regular URLs like this:
/library.dll?page=page12&arg1=0&arg2=some&session_id=7892734
and special pages like this:
/library.dll?page=specialpage&arg1=0&arg2=some&session_id=7892734&id=page13
aswell as encrypted URLs like this, which are also containing the session id:
/library.dll?page=encrypted&args=gYZEI7lnRAQLzVXdtdbcral8.cOoc6NDtMUGY2yep9wO3JM
So the interesting niformation is always the page, which is in this examples page12, page13 and page14 (where page14 is also part of the encrypted string).
Clarification
I can change the HTML and JS code only. I have no access to the Google Analytics interfaces at all. This will be administrated by multiple customers.
The GA code will be integrated within a template using a customer-specific code and their unique tracking id.
Problem description
I need to track the page argument, because this is basically the interesting part of the url. When tracking other url parameters I cannot accumulate the pageviews for a certain page, because Google Analytics shows them as separate pages.
In addition I don't see any way to track the pageviews with encrypted URLs, because I cannot set a generic name for them unless there is a way to utilize the method ga('send', 'pageview');
Solution idea
I read about overwriting the pageview attributes like this:
ga('send', 'pageview', '/my-overridden-page?id=1');
in the article on page tracking #Google Developers
Utilizing (event) triggers is in my opinion a pretty bad idea.
The question itself
Is there any smarter way to track this information? Is extracting the page-information and overwriting the pageview attributes the best way to do this?
I just started using GA and have kind of no idea how to do this any other way.
You could use filters (custom advanced filters) to rewrite the request url inside the google admin interface (admin->views->filters). This has the advantage that you do not need to change your site/application code.
However using filters will require multi-step-filters with heavy use of regular expressions, and you would have to test this in a "staging" view first (because a wrong filter will permanently mess up your data).
Passing a custom url to the pageview tracking is pretty straightforward and can be tested immediately via the real time view. In my opinion this is indeed the smartest way to do this.
When looking at Google Analytics, all reports show URLs that begin with a slash and www: "/www.url.com/page.html."
I've never seen Google report like this. Webmaster Tools is set up correctly. Not sure what else can be set up in Analytics. Any idea?
Current: /www.url.com/page.html
Typical: /page.html
by default GA only reports the relative path and query string of the URL (it strips the protocol and domain. So one of two things must be happening:
1) you have code that is passing a custom page name to the _trackPageview call, adding that "/[domain]".
2) you have a custom filter within the interface setup that is prefixing the page name with "/[domain]"
Adding the domain to the page name is a fairly common thing to do when you have GA code spanning multiple domains, most especially when they are going to a rollup profile, so that you can see which pages are coming from which domain.
So if I had to guess (and this is only a guess, seeing as how I don't have access to your
code or GA interface), someone must have attempted to rebuild the full url to use as the page name instead of just the path+querystring - and then messed up (probably a messup in some regex with the protocol, if I wanted to throw even more guesses at it).
But the 64 thousand dollar question is.. where is it being changed? Like I said.. GA by default does not do this, so someone has added code to do it on your site, or else a filter within the interface.
I would start by looking to see if there are any filters in your interface, since that is the easier thing to determine. If you see no filters relevant to this, then you will have to look on your page code (including any script includes or other javascript code being output). It would be a value passed with _trackPageview so ctrl+f for that.
I'm currently using Google Analytics to get reports for my project hosted on code.google.com.
I'd like to exclude the traffic generated by myself. I know that Google Analytics basically offers two way to filter my traffic: by IP address and by cookies.
The ISP gives me a dynamic IP address so I can't filter by IP address. I should then use the cookies method.
I read I should add some javascript code to my site to set the cookie.
My question is: how can I add into the wiki pages of google code the javascript I need? Is there another way to achieve my goal?
Thanks.
http://ode2code.blogspot.se/2009/02/how-to-exclude-self-traffic-from-google.html contains a solution that seems valid:
Setting the cookie:
Create a new page on your domain, containing the following code:
body onLoad="javascript:__utmSetVar('no_report')"
Visit this page from all computers that you would like to exclude from
your reports, to set the cookie on each machine.
Creating the filter:
You'll need to create an Exclude filter to remove data from visitors
with this cookie.
Filter Type: Custom filter > Exclude
Filter Field: User Defined
Filter Pattern: no_report
Case Sensitive: No
How to create a filter?
http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55494
Use this together with this wiki article http://code.google.com/p/support/wiki/WorkingWithGoogleGadgets to create a gadget containing the script that you may include on your page.
Several chrome and firefox extensions are available that allow you to block google analytics tracking on a per-site basis. I have found this is the easiest way to achieve this functionality.
You can try the Google Analytics Opt-out Browser Add-on, though it will disable tracking on all sites altogether.
how about using the campaign tracking feature to create a specific urm URL you send out to any person you wish to exclude from reports?
Then add a campaign filter, how's that?
not sure how long the campaign cookie will be stored, may need everyone to click that camapaign URL every few weeks?
If there is no query parameter in the url of search bar results and I want 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.