1) Detect Fan: You cannot find out if an user is a fan or not using Facebook Javascript. You will have to create separate buttons and render them so that only either one is visible at a time using the visible-to-connection tag. This can then be used to run different Javascript onclick to perform actions for a fan and different actions for a non fan.




2) Detect Activity: To detect activity on your facebook fan page, you just need to place code between script tags as in the code for this page. The code will get executed whenever an action causes Javascript to execute and will only be executed once

3) Track Clicks on Buttons: We can use onclick event handler to trigger our tracking image to be loaded. Here is an example of the tracking image being loaded on a click. This can be used on Step 1 to make load the tracking image for a fan if the logged in user is a fan. Alternatively, the tracking image for a non-fan can be shown if the user is not a fan.



4)Sourcecode: The source code that runs this page is open for you to improve upon. The link shown only to fans (Our clever ploy to get more fans!) Thanks for being a fan, here is the code!