Google Analytics for Facebook Fan Pages
We launched our Facebook fan page earlier this month and as with all Facebook pages only Facebook Insights program is available to page administrators. Facebook Insights shows demographic details and interactions on your pages BUT limited to show information of fans only. It is far less sophisticated and comprehensive when compared to the free Google Analytics. One of the limitations of Facebook Fan pages is that you can only run limited Javascript on it and Google Analytics needs Javascript code included to correctly track visitors. We have successfully managed to get ALL functions of Google Analytics working on our Facebook fan page (including visitor statistics, traffic sources, visitor country, keyword searches with all other powerful reporting & maps overlays etc).
How to setup Google Analytics on your Facebook fan pages
The workaround we use in our code is to include Google Analytics as an image instead of setting the standard Javascript. This method tracks every visitor to the custom facebook pages on Google Analytics. It required a combination of server side cookie management and an additional <img> tag to the bottom of the facebook fan page. Here are the steps to get Google Analytics working on your facebook fan page.
1) Setup Google Analytics account. If you already have one, create a new website profile. You can name it facebook.com or facebook.com/your_page_name. You will finally get your tracking code which looks like this UA-3123123-2
2) Create your custom img tag for each of your pages you like to track. EG: contact form, services, products etc. You can use our tool to create the Google Analytics link generator for Facebook pages.
3) Add the entire custom image html tag from step 2 to the bottom of each Facebook fan page that you need to track.
That is all there is to it! Google Analytics is not real-time, so you will need to give it some time. Approximately a day before you see the fruits of your “hard” work.
For advanced users
Use this method, if you don’t want to use our hosted link redirection as mentioned in the method above. You can download the entire source code which is just about three files to get this setup working on your own server (running PHP4.3 or above). The code is written in PHP and essentially creates the Google image tracking URL with the referrer, page information, ID, etc. The additional advantage of hosting this on your own server and domain is that visits from your website to your facebook fan page gets tracked, etc. You will also be able to customise further if you wish. Please do share any useful updates you apply to the tracking link code.
Facebook – Google Analytics Tracker v1.1 (Updated 21st Feb, 2010). For advanced method – Download this code to use on your server.
If you don’t have a Facebook fan page yet, visit our tutorial for code and help on creating customised Facebook fan pages.
PS: We could not find any other source / blog that described how to get Google Analytics on Facebook fan pages! There is support for canvas pages and applications but nothing for StaticFBML fan pages. Hope this helps and please leave your comments below.
UPDATE:
1) A lot of users have asked how to track visits to the wall. Yes, this can be done. Please see the comments by iphp below.
2) Here is a screenshot to a staticFBML where the code should be placed
3) We have managed to set up funnels, goals and segments to separate fan and non fan activity.
4) Video: Here is a link to the Webdigi youtube channel check our favourites to get step by step walkthrough!
5) This blog and comments cover all aspects of setting up Google Analytics. If you still want help, we are available to offer paid support and installation of Analytics for your page. Please contact us here.
good!
AWESOME!!!!
thanx
Great. I think that it’s best to know who has visited me.
Great. Thanks
good to know
Thanks
totally awsome
Great!It is a good think!
This is great
I have setup google, generated the code, but as usual, facebooks stumps me. I setup and FBML page, but cannot add or insert the generated code anywhere. Can you please help me and walk me through why I cannot have a proper FBML page I cannot edit?
Thank you very much.
E
great!
terrific
thanks
good article
Pingback: Comment installer Google Analytics sur votre Page personnalisée Facebook | Nicolas Bariteau Conseil
Pingback: Fanpage Customization Secrets – Custom tabs and Applications « Mahesh Narayanan
good going!!!
Wish I could track outbound clicks on my FB page. This will only track visits. Great solution though and one of the few around. If anyone has any advice on how to track outbound clicks on a FB Fan Page, I (and everyone here) would certainly welcome this info!
Thanks!
@Jason, Yes you can track outbound clicks on a FB Fan page. You can do much more on Google Analytics, please read our advanced article on Facebook Google Analytics
Great and inspiring article it is!
One nuance that worries me however is that my GA dashboard suggests that every visitor to my fan page uses ‘facebookplatform’ browser and all visits were made from USA, California, Santa Clara or USA, Virginia, Ashburn 🙂
As the only visitor I am sure that I am not there. Other information about visitor client is (not-set).
Can anyone help me fixing that (already tried webdigi and private hosted versions of FBGAT, added debug logging and all seems fine).
Thanks!
All visits are tracked perfectly for me. Thanks so much for this awesome work!
Hello!
This open source tool and all your hard work is much appreciated!! Thanks for sharing and for being so active in the comments and questions people have posted. I have 3 questions for you and/or the readers out there.
First, I was curious about filling in the form for the code generation, as well as the info you put into GA on signup.
In GA: do I put the domain I want analytic for as “facebook.com” or as “facebook.com/myPage” ? does it matter
as for FBGAT, when filling in the ‘page link’ field it appears you use a partial URL (ie. “/subdomain.html”). But what about small additions to the URL(cant think of a better way to describe :S )? I’ll give an example. Do I enter:
/ColumbiaCanada?v=app_7146470109&ref=ts
or
/ColumbiaCanada?v=app_7146470109
Secondly, how can this be made to work for tabs that ‘come with’ the Page (ie. wall, info, etc.)–by which I mean tabs that you cannot edit through FBML tab?
Finally–just so I understand more fully how this method works–you guys are sneaking GA onto the page by tracking the image that will be added to the page (I see a small ‘broken’ image at the bottom of my page when I add the code). Is your method, essentially, using GA to grab info about the image being loaded/accessed on your FB page, and using that as a proxy for tab visits?
Hi there
Apologies, I’m a bit of a novice! I’ve followed the steps above for adding google analytics to my facebook page, but…
How do I actually do this?:
“Add the entire custom image html tag from step 2 to the bottom of each Facebook fan page that you need to track.”
Thanks!
Hi @iphp thank you for this article!
i wanted to ask you something about the installation:
1.i downloaded “Facebook – Google Analytics Tracker v1.1”
2.i made a directory on my server and placed the folder.
3.i went to index.php
4.i genertaed the code.
now one thing ive noticed is that my generated code looks different from yours:
*****
*****
—–> index.phpfbga.php? are sticked together and when i generate this from your host it shows only fbga.php? without index.php
will this cause any problems?
thanks heaps,
Daniel
@dmac Yep, you’ll need to change that line. It’s calling a file to pass parameters to. index.phpfbga.php isn’t a real file, so this will produce nothing. You’ll want to change it to fbga.php (remove “index.php”). HTH.
thanks for the great work
good going
how do you do this?
Great help!!
thanks for the info very helpfull cheersssss
Very interesting…
This is really good info.
this is a really great idea.
Yep, brilliant!
great idea..!!
yeah cooooool
🙂 xxx
wtf!!! this is just GREAT!
yep it’s great
it’s awesome
Informative comments for those who wish to access this info
Thanks this is great….nice to know if a certain person wants to contact me…appreciate your effort in developing this app
this is a good idea
briiliant
Nice one
This is totally brilliant, thanks for opening up to the world.
Has anyone tried tracking the Wall page since the Facebook introduced the New Layout? I don’t see a way to load the FBML on the Wall anymore. Anyone come up with a workaround?
yep/brilliant
@ iphp
I haven’t read all the 313 comments to telling you the truth ; ) but I was looking for the information on how to set the image I prefer (among your gifs) to load on the fanpage tab – I’m using the FBGAT pack on my server.
Please give me a hint! ; )
Pingback: Quora
great STUFF!!
@iphp
so, since facebook removed boxes, we can no longer use this to track visits to our wall???
good info!!!
Hi
Brilliant posting, I have been designing facebook pages for some of my clients, will certainly look to add this functionality to the pages.
Site bookmarked!
iphp –
Fred on 1/12 asked “Has anyone tried tracking the Wall page since the Facebook introduced the New Layout? I don’t see a way to load the FBML on the Wall anymore. Anyone come up with a workaround?”
Does your suggestions work with the new layout. I think this stuff is some of the most brilliant stuff I have read in awhile. Thanks for the updates.
stapuff106
Pingback: How to Set Up Google Analytics for Facebook Fan Page » Fiphy.Com – Internet, Technology, Google, Facebook, Microsoft and Apple News -
@Gabriele: I couldn’t add a box to the new fan page layout … Maybe I’m missing something. Weren’t they supposed to be discontinued anyway? Anyone got an example?
Also, as far as I can tell, facebook is running the images through it’s proxy … so no direct link us/google … Can someone clear this up please?
I have same problem that Fred and Kurt.
I need new solution about the Google Analytics on Wall of Facebook Page.
@Kurt – with the new layout there are no boxes anymore. This means, there is no way to integrate StaticFBML on the main wall anymore – which is a bit of a shame – this method would have been a really good insight next to the Facebook page insights which don’t show very much details.
@sam Steiner
You are right , there is not more boxes now 🙁
Pingback: 35+ tips and tricks for sexier analytics
Hi There,
I have a question. I made an custom image html tag and have to add this to the bottom of eacht Facebook fan page that i track. But how do i do that?
Can someone help me?
Thanx,
Leander
Pingback: Designing A Facebook Fan Page: Showcases, Tutorials, Resources
Nice Post! Very informative.
Has anyone come up with a solution to track the Wall page since the new layout?
Facebook should look into providing this feature 🙂
Kudos
@ Kurt – So basically you are saying that this method is not longer applicable to track the wall right?
I tried to set it up and I was able to get it working for a static page. However the StaticFBML is no longer available for download directly from Facebook. I got it here and was able to track a new page, which I called “myPage 1” but this is not very handy as most of my traffic comes from the wall.
Has anyone found another method for integrating Google Analytics into their wall page?
Great resource by the way, pitty it can’t track the wall anymore.
Pingback: Designing A Facebook Fan Page: Showcases, Tutorials, Resources | W Design Love | Graphic and web design blog
Pingback: Measuring the Success of Your Social Media Activities « eBusiness Buddy
Not a techie and I got it going so thanks a ton.
HI,
Actually I want to track and have it in my Google Analytic account each time a member click on the facebook link on the newsletters.
Yes I generate the code for facebook tracking and I paste it on the bottom before the end body.
Is it mean if I clic in an any facebook link on my newsletters it ll show on GAnalytic
Pingback: Google Analytics for Facebook Fan Pages! « A. James Editing