Reputation: 59313
I have recently looked into this and discovered that using FBML pages in a facebook fan page, I can add fb:google-analytics tags or image tags to track page visits. However I have found no method of tracking visits to other facebook tab pages, like "pictures" or "wall".
Is there a way do this?
Thanks
Upvotes: 0
Views: 2550
Reputation: 37305
There is no way of doing this with Google Analytics.
There used to be a hack that embedded a php file as an image, and that request tracked a pageview. However, a change to how Facebook renders pages makes this hack/plugin useless (it looks like it stopped working on September 7th). Basically, it looks like they're caching any external images onto their own servers, and thus breaking this hack. Short of there being an officially supported plugin, or Facebook allowing Google to track more, this is likely a dead end.
Edit: With Facebook tabs, you can install an iframe app as a tab (not using FBML), and you can put Google Analytics on the tab. But, since its an iframe, you don't have access to real referrer information, and Facebook spoofs its referrer, so there's no way for the iframe to detect anything about the page. But this is only for the tab, not for the wall or photos.
Another important thing to note is that the cookies are still being set on your domain, so it might make sense to keep the account on your main account, but use a special configuration on the tab.
Here's the best practice I've settled on for putting Google Analytics on a Facebook tab iframe:
First, the iframe URL should contain the URL parameter ?utm_nooverride=1
. This is so if the user already has referral cookies (for example, if they got to your site before via Google, the pageview will persist with that referral source.)
Second, I override the referrer value (which is useless, since it is spoofed by Facebook) to be tab.facebook.com
, to make it simple to differentiate from other traffic.
Finally, I place 2 custom variables: One page-level, and one visitor level. The former allows me to easily know what pageviews occurred from within the tab. The second allows me to track the rest of the interactions my site has with this person if they end up returning to my site. That code looks like this:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-1']);
_gaq.push(['_setReferrerOverride', 'http://www.tab.facebook.com']);
_gaq.push(['_setCustomVar', 1, 'is_facebook_page', 'true', 3]);
_gaq.push(['_setCustomVar', 2, 'visited_facebook', 'true', 1]);
_gaq.push(['_trackPageview']);
Upvotes: 3
Reputation: 13125
Facebook does provide some limited analytics capabilities called Facebook Insights:
Also outgoing links will be tagged with a tracking code so you can pick up which traffic is coming from your Facebook pages to your site.
However you cannot embed Google Analytics or Yahoo Analytics directly into the pages.
Upvotes: 0