FBGAT – Facebook Google Analytics tracker
FBGAT is a free and opensource tool created by Webdigi to work around Facebook’s Javascript restriction on Facebook fan pages which prevents Google Analytics from working correctly. There are two key parts to this tool.
1) The code generator: This helps users generate a code for each individual areas that has to be tracked on Google Analytics
2) The tracker: This instructs Google Analytics on each page load to log visits, IP address, browser, country, etc.
Here are general instructions on how to setup Google Analytics on your Facebook pages.
The hosted version
The hosted version of FBGAT is free to use (no plans to charge for usage). We will try to keep this up-to-date with improvements we make and will try to ensure that it runs without any downtime. We also relying on this server to track our Facebook fan pages. However, there are no guarantees of any sort that this will also be available. If you are more comfortable hosting your own version of FBGAT. Please feel free to grab a copy and run it on your server.
To download and setup on your own server
You will need an externally accessible webserver running PHP to install FBGAT and run it by yourself. There is nothing to configure and there is no requirement of a database, etc. Please feel free to share your ideas back to us and back to the community at large if you make any improvements.
FBGAT Download
Version 1.1 (download) released on Feb 22, 2010.
Here is the link to FBGAT on Github (use this to track updates, file bugs, ideas, etc)
* You are free to do whatever you want with these files, respecting other licence agreements. We have seen Chinese and German translations of this tool popup. We would be happy if you could link back to our original work but that is also entirely your choice.


I’m attempting to use this free service, which by the way i appreciate. However, the instructions are a little vague. I’m installing this on my own web server btw. Is there a certain directory these files need to be uploaded to. Also, how do I run it?
This page was not intended to give out instructions. This is the central area for file updates and news on FBGAT. Here are the instructions:
1) How to setup Google Analytics for Facebook pages
2) View Fan/Non-Fan visits, Funnel visualisation, Goals, Tracking page activity
@Steve, you don’t have to upload FBGAT into a specific directory. Just upload it anywhere and then use the link generator.
Good initiative…keep up the good work!!!
I’ve uploaded the scripts, and started to test them. However, when GA showed no traffic, I tried to load one of the created tracking images in a browser.
I am getting an Parse Error, Galvanize.php on line 23 when testing the img in a browser. I am using PHP 4.3.8
Any thoughts?
Thanks!
@Barbara, you will need to use PHP versions greater than version 5 ideally. This is because it uses PHP classes and the public and protected access modifiers work only in PHP 5 or greater.
[...] there is a new solution. Using free and opensource FBGAT (Facebook Google Analytics Tracker), you can get Google Analytics working on your Facebook fan page. Now you can track visitor [...]
[...] FBGAT is is a free tool that can generate a the code necessary to bypass the Javascript limitations on Facebook. [...]
[...] down to FBGAT – The FaceBook Google Analytics Tracker. You can download and host your own version of this [...]
I don’t have access to php version 5. I tried to change the code to work on php4 and I get it to work, but unfortunately I haven’t seen a single hit come through on Google. Matter of fact in Google they’re still showing a yellow icon instead of a green one.
Can you suggest anything?
hey, i have the code on my server when i generate the link and add it to my facebok page i get an x for image. What am i doing wrong? if i add the code for hosted version it works fine
Thanks
[...] there is a new solution. Using free and opensource FBGAT (Facebook Google Analytics Tracker), you can get Google Analytics working on your Facebook fan page. Now you can track visitor [...]
[...] lies behind this is a little tool called FBGAT. FBGAT is a free and opensource tool created by Webdigi to work around Facebook’s Javascript [...]
I got the code, but where do I put it on my site? where do i enter it? I realize I have FBML but, isn’t that only for tabs? or pages within?
Thanks for the wonderful tip. I managed to follow the instructions in detail and setup my first user interaction tracking. I cant thank you enough!
This method works beautifully with facebook pages and google analytics.
When i download the FBGAT v 1.1 it only shows me picture icons and no files. Help
@James, please read the original article here http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/
@Amit, I think you have a different version of PHP, we need versions above 5.
@Akar Jonas, Excellent!
@ maya, you need to upload all the files to your server to setup your own hosted version. The code files are in there with extension php, js, etc. You can also use the hosted version as described here http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/
[...] people visit your Facebook Page, then sign up for a free Google Analytics account. Next download FBGAT. Then follow the steps here to add the tracking code to your Facebook Page. Basic HTML knowledge is [...]
This is really excellent! Thanks for sharing!!
I have external links on my facebook page. Is there any way to track how many visitors clicked on those links ?
Yes, you can track external links on your facebook page. You will have to use the onclick function. Please take a look at this article http://www.webdigi.co.uk/blog/2010/tracking-user-engagement-on-facebook-fan-pages/
[...] there is a new solution. Using free and opensource FBGAT (Facebook Google Analytics Tracker), you can get Google Analytics working on your Facebook fan page. Now you can track visitor [...]
[...] Facebook – Google Analytics Tracker v1.1 (Updated 21st Feb, 2010). For advanced method – Download this code to use on your server. [...]
Hi,
I am looking at the code you are putting in static FBML and seeing that you are basically declaring an with a ref to an external PHP source.
I am trying to do the same thing to a script that either returns a pixel, either returns an image based on various conditions that live on my server but it doesn’t seem to work. Any ideas?
Thanks in advance!
[...] there is a new solution. Using free and opensource FBGAT (Facebook Google Analytics Tracker), you can get Google Analytics working on your Facebook fan page. Now you can track visitor [...]
Thanks!
I admin about 12 different brand’s fan pages, and this is an easy, essential work around for my Static FBML tabs.
[...] Analytics with your Facebook page is really simple and the plugin that makes it simple is called Facebook Google Analytics Tracker. Here is a quick tutorial describing how to integrate Facebook Fan page with Google [...]
Hi, I’m trying to set this up on a friend’s page – came across you via shoutmeloud.com/how-to-integrate-google-analytic-with-facebook-fan-page.html
I’ve uploaded files to his server, however, when I put in the url to where it’s located I get this error: A file permissions error has occurred. Please check the permissions on the script and the directory it is in and try again.
What should the file permissions be set to?
Thanks for your help
@Sarah – Please try and change the folder permission to 777, that is most likely to solve the problem!
[...] there is a new solution. Using free and opensource FBGAT (Facebook Google Analytics Tracker), you can get Google Analytics working on your Facebook fan page. Now you can track visitor [...]
[...] Facebook – Google Analytics Tracker v1.1 (Updated 21st Feb, 2010). For advanced method – Download this code to use on your server. [...]
I like the whole idea and finally i am happy because this javascript code will help us to track all our facebook fan pages.
thanks to share with us your innovative thoughts.
[...] to include Javascript code into the fanpage. Now here is a solution i.e create a custom image using FBGAT. FBGAT (Facebook Analytics Tracker) is an Opensource that can help you create a custom image code [...]
[...] add a typical Google Analytics tracking code to your Facebook page. The free, opensource tool Facebook Google Analytics Tracker (FBGAT) allows you to add your tracking code within an img tag that Google will recognize. For a [...]
[...] 4. FBGAT (Facebook Google Analytics Tracker) [...]
[...] there is a new solution. Using free and opensource FBGAT (Facebook Google Analytics Tracker), you can get Google Analytics working on your Facebook fan page. Now you can track visitor [...]
[...] suggest using the a free program called FBGAT (Facebook Google Analytics Tracker) that allows Google Analytics to work on your Facebook page. Now you can have accurate statistics of [...]
[...] to include Javascript code into the fanpage. Now here is a solution i.e create a custom image using FBGAT. FBGAT (Facebook Analytics Tracker) is an Opensource that can help you create a custom image code [...]
Thanks for a great article.
Thank you very much, it’s realy helpfuly article (for me!).
Thank you for the valuable tool.
Unfortunately FBML is no longer functional as of June 2012….
https://developers.facebook.com/docs/reference/fbml/
Is there a recommended alternative?