I have a question regarding Google Analytics and unwanted referral stats generated by a bookmarklet.
I have a web service with GA installed. My users are using a bookmarklet to accomplish a certain task while visiting some other web page. Bookmarklet creates an iframe and opens up a page which is also on my domain and that page contains the same GA code.
For some reason GA sees those web sites (pages that bookmarklet was used on) as referral pages. That creates a problem for me since those pages are not real referrals (no actual links to my site). I have no desire to track pages my users marked with the bookmarklet.
It’s important to mention that bookmarklet page must be a part of the same domain as my main page. I can not move it on other domain or subdomain.
This is what I tried so far:
I’ve created a new GA account (subdomain.mydomain.com) and used it only on my bookmarklet page hoping that all stats related with the bookmarklet will appear on that account. This worked only partially. Stats for the bookmarklet started to appear on the new account but my original GA account continued to track referral pages.
We tried to use a pop up window to load a web page instead of the iframe. No difference.
Any help on how to get rid of unwanted referral sites would be appreciated.
See _setReferrerOveride:
_setReferrerOverride()
_setReferrerOverride(newReferrerUrl)
Sets the referrer URL used to determine campaign tracking values. Use this method to allow gadgets within an iFrame to track referrals correctly. By default, campaign tracking uses the document.referrer property to determine the referrer URL, which is passed in the utmr parameter of the GIF request. However, you can over-ride this parameter with your own value. For example, if you set the new referrer to http://www.google.com/search?hl=en&q=hats, the campaign cookie stores a new campaign with source=google, medium=organic, and keyword=hats.
_gaq.push(['_setReferrerOverride', 'URL-YOU-WANT-AS-REFERRER']);
Or, you could try
_addIgnoredRef():
_addIgnoredRef()
_addIgnoredRef(newIgnoredReferrer)
Excludes a source as a referring site. Use this option when you want to set certain referring links as direct traffic, rather than as referring sites. For example, your company might own another domain that you want to track as direct traffic so that it does not show up on the "Referring Sites" reports. Requests from excluded referrals are still counted in your overall page view count.
Async Snippet (recommended)
_gaq.push(['_addIgnoredRef', 'www.sister-site.com']);
You would have to grab the referrer and populate it dynamically. Probably with parent.document.referrer Of course this might make any referrals (non-bookmarklet) from these sites not record in the future. And, at some point you would need to clear them.
The most simple solution, if you don't need to track the hits from the bookmarklet at all, is to simply not include the GA code in the web page when it is opened by the bookmarklet.
Your bookmarklet can open the page like http://yoursite.com/?mode=bookmarklet
And in your server side code you can use something like
if ( mode != "bookmarklet" ) {
outputGaCode()
}
Related
I have a question about filtering / segments in Google Analytics for a unique scenario with one of my clients. I essentially want to block a page URL forever out of analytics --- never see it counted page views, top pages, etc. What is the best way to do that?
Developers added a widget to my client's website which uses an iframe URL from their domain. This iframe is on 30+ different URLs which makes this URL seem like it is the #1 top page which is severely skewing their analytics. I am told there is no other way to do it - especially with the budget/scope of work - which means I need to find the best way to filter this out of Google Analytics reporting.
For instance, I am looking at "Behavior - Overview" - this iframe URL is #1. I know I can click into "view full report" and from there hit advanced and exclude this page to get the real results.
However, is there a top-level filter that can be permanently activated to block this page so you do not have to do the advanced filtering every time you are in Google Analytics?
Thank you for your help!
Just to confirm, your issue is this:
https://support.google.com/analytics/answer/1012049?hl=en
"Inflated number of pageviews"
If you just want to block it, would this not work?
In GA, go to Admin -> Filters -> Create new filter -> Custom -> Exclude by Request URL -> use the URI that you refer to.
I'd be interested to know if that works!
I can't imagine this is an uncommon problem, but we keep running into challenges.
We have a campaign with a landing page on our site, with a form visitors can fill out. They give us their email, we email them some content. We want to track this as a single GA conversion.
Right now the setup has three pieces:
1) The campaign landing page on our web site
2) The actual form they fill out, which is in an iframe and hosted on a subdomain (info.MMMM.com instead of www.MMMM.com) (this form is managed and hosted by marketing automation service Pardot)
3) The "Thank You" page to which users are redirected once they fill out the form. This is on the main domain, not the subdomain.
We're using Universal Analytics, I believe. We have the stock UA snippet in the overall site footer, so it already appears on both the landing page and the thank-you page.
We have a cross-domain issues, in that right now info.MMMM.com appears as a high-traffic referrer. Of course this is wrong -- that's our own subdomain, and it's masking the real referrer.
I've been following Pardot's instructions for cross-domain tracking. In doing so, I added our UA code snippet to the code generator for the iframed form. This works, but the Google Tag Assistant then tells me I have two GA tags for the same property (one in the iframe and one in the overall page footer I guess).
Am I headed up the wrong tree? Should I just be following the guidelines for "Cross domain auto linking for forms" on this Google page?
https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain
Any pointers would be helpful.
Thanks,
SGL
I would like to use the google analytics visitors flow tool but it does not show any specific page. All visits are in one big block "/". If I click on "group details" pages are listed just fine.
My site uses url parameters like mypage.com?p=products to switch between pages. I have managed to set up analytics so that it understands this and works on the "content" page and everywhere. How can I make it also work with "visitors flow" to display specific pages?
this might be the same problem: Google Analytics: 100% Drop off from landing page
Just noticed that links on my page are missing the slash before the "?". will add the slash and report back.
Edit: Though I guess that was an improvement it did not solve the problem.
I am using absolute links (http:/mysite.com/?p=contact) all over the place. Should I try relative links to get this to work?
Yes, you need to put a / before the ? in your links or else Analytics could interpret your full URL as the domain/sub-domain and not report any page paths or levels (like you're observing).
Additionally, are you sure the Analytics script is firing whenever a new page is loaded? Clicking through your site it looks like the base page template may not be reloading whenever you click to a different page (only the content is reloaded). If this is the case and the Analytics script is part of your base template, it would only fire once when the visitor first enters the site and load the page template and never again. Since Google Analytics calculates pageviews and time on site/page based on the difference in time between when the _trackPageview() is fired, it could explain your problem.
I would suggest moving your Analytics script to a portion of the markup that is reloaded every time someone clicks to a new page to see if this does the trick.
I am having two GA reporting problems with a site I manage that I am not sure how to solve:
The site is showing up as a referrer to its own domain in GA reports.
My goal completions (sales conversions on 3rd party off-domain
ecommerce cart) are all showing the site's domain as "source" when I
obviously want to see the true "referers" who are sending traffic
that results in goal completions.
My thoughts on potential reasons why this could happening:
I am using absolute paths for internal links, like this:
<a href="http://example.com/contact.html">
as opposed to
<a href="/contact.html">
Could this be it? Users often do click around internally before they purchase.
Also, on several high traffic pages, I am using javascript history backlinks, like this ::
go back
Lastly, I'm doing a 301 redirect on "add to cart" traffic clicks so that
http://example.com/add_to_cart
redirects to:
http://paymentprocessor.com/ugly_url/cart_page.html
(Although this is an external 3rd party domain, my GA code still fires there)
Any guesses why I am experiencing the issues stated at the top here? ... thank you to all you GA wizards.
UPDATE UPDATE UPDATE
Thanks Eduardo for the great answer.
Thought I might share that now for href text links to 3rd party ecomm site I am tracking events with jquery via class, so my _gaq.push to track both the click event and copy the cookie data over from my site to the third party site looks like this:
$('a.index_addtocart_smallest').click(function(){
_gaq.push(['_trackEvent', 'Outbound Links', 'index_addtocart_smallest', 'buy_click'],['_link', 'ssl.thirdpartyecom.net/order/']);
});
And when I use the form action "add to cart" submit in the HTML look like this:
<form action="http://example.com/add_to_cart" method="post" onsubmit="that=this;_gaq.push(['_trackEvent','Outbound Links','index_big_buy_button', 'buy_click'],['_linkByPost', this]);setTimeout(function() { that.submit() }, 100);return false;">
... to track the event, and post the existing cookie to third party server, while adding a delay to the click to make sure it is captured by GA.
In my case I am using the asynchronous syntax for Tracking Between a Domain and a Sub-Directory on Another Domain: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#domainAndSubDirectory
In your case it's very clear that the problem is with the cart. When you redirect the user to your cart domain he lands on a new domain and lose access to the cookies that he was using on your site. Because GA needs to create a new set of cookies on the cart site it also creates a new visitor id and a new visit, that visit will be a self referral because that's where the visitor is coming from from GA point of view.
Google Analytics keeps state on cookies, __utm*. So when changing domains we need to copy the cookies from the domain you are currently in to the domain you are moving to. The google analytics API offers some methods to implement this. This is often known as "cross-domain tracking" or "multiple domain tracking". Google Analytics documentation offers a good explanation on how to implement it. You can also search Stack Overflow for several questions related to cross-domain tracking, people seem to have a hard time getting it right.
You are free to use absolute or relative links, it makes no difference for Google Analytics at all.
Javascript redirects are usually ok. Even though there are cases where they certainly make things a little bit more difficult your use case of a back button is fine and should not be causing any problems at all. Of course if the javascript redirect changes the domain you are in you are back to the same issue and needs to implement cross-domain tracking.
Sometimes internal referrers are legitimate. One example of legit self referrals: When a user visits a page on your site and stay there for over 30 min, then navigates to a second page. In that case after the 30 minutes the visit expires and when he navigates to that second page a new visit is created. This new visit will be a self referral and the second page will be considered a landing page. That might seem odd at first, but this is a self referral and it's usually fine.
I have a site that contains the file
redirect.php?id=123
It redirects folks to another site using an id it pulls from the database.
I'd like to track the page on Google Analytics, see where users are coming from, and what popular sites they're going to.. etc.
I currently set up the page so that it pulls (with PHP) the link from the database, and outputs the ga.js stuff and a javascript redirect.
The issue is that I'm getting the data on my analytics dashboard as if every id is a different page..
What is a better way to do this?
If you want to check for pages of the type redirect.php?id=x then the page Carlos links to is how you would do it.
You would want to exclude the id parameter from your search. Then Analytics would combine all the redirect.php?id=1 redirect.php?id=2 redirect.php?id=3 pages as just a single page named redirect.php
How do I exclude query parameters from my reports?