Is there a way to catch the click event on the FourSquare follow button (https://foursquare.com/business/brands/offerings/followbutton) in order to add Google Analytics tracking with it?
Is there an API similar to the Twitter Tweet button and the Facebook Like button?
I couldn't find anything on the FourSquare site.
There doesn't appear to be comprehensive documentation of the Foursquare follow button, but I've been able to glean this much:
Unlike the Twitter and Facebook buttons, the Foursquare button is not in an iframe. That means you can capture clicks on it as you would clicks on any other element.
$("div[id^=fourSq_widget_id] a").click(function(){
_gaq.push(["_trackSocial", "Foursquare", "Click"]);
});
However, tracking this click doesn't mean anything; it doesn't tell you if the person followed through on the action of following, since that action takes place in a third party iframe.
There does appear to be an undocumented JavaScript API in the fourSq
object for tracking the actual follow through on the action, but its not clear how to enable it.
It looks like it's something like:
fourSq.widget.Events.bind("follow", function(){
//do something
});
However, the only way I can seem to trigger it manually is with the accompanying trigger
method. So, I'm not sure how to enable this undocumented JavaScript API so that it listens to actions taken in the modal window that pops up..