122

Google Analytics for Facebook Fan Pages

Posted by iphp on Feb 22, 2010 in Facebook, PHP, Project

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).

Google Analytics Example

Google Analytics Example

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

Tags: , ,

 
9

How to get your side project launched

Posted by iphp on Aug 23, 2009 in IT, Project

There are many people who have a lot of interesting ideas in mind but never get around to starting on their side/pet project. Some people start on their side project but never get to completion. These are the three steps which if followed before you start actual work on your project will help you get your pet project launched.

1. Think things through
- This is the most important step. If you do this well, consider your side project well begun and half done!
- Visualize things after completion will it make you happy? Will it make you feel like you accomplished something? Will it make you feel successful?
- Humans operate with pain-pleasure principle.  Will the completion of the project alleviate your pain or others pain? Will it bring some pleasure to the work and lives of others or yourself?
- When the going gets tough with your pet project as it often does, these reasons will help you and give you the strength to complete the project.

2. Set a deadline with detailed plans
- Start by identifying all the steps you need to complete and each stage.
- When can you reasonably finish the project?
- When do you want to launch? When do you want to get your product or service out to the public?
- Make detailed and specific plans, not vague ones.
- Also the most important rule, remember nothing is perfect. You will have to refine after launch and constantly learn from it. Take a look at the first version of Google. Your first launch is the beginning get ready to quickly make changes depending on user feedback.

3. Make commitments
- Tell your friends and your family you are going to launch on the deadline.
- If you had prospective customers enquiring about product, let them know that you are launching the product or service on the launch date.
- Schedule banner ads, ppc ads, book presentations, print leaflets, etc as required to promote your project and get you to focus on the launch.
- Get a mailing list of all people who you know that will be interested in the project.
- The third point in my opinion is the one most often ignored and causes deadlines to slip. If  your family & friends know that we are busy working on something they might understand not to bother you until your launch date!

The first point on thinking things through will energize you or show you that this project should never be done. The third point will commit you to the deadline and hopefully clear out distractions as your family and friends are now aware of what you are working on. Only once all the three steps above are complete you should start working on your project and in accordance with your plan.

If you are working on your pet project please do share your experience!

Copyright © 2010 PHP, Web and IT stuff All rights reserved. PHP Web development in London.