I would like to apply event tracking in google analytics to facebook comments made on our website via the facebook social plugin (iframe widget), but I can’t seem to find a way to attach the event. I would prefer if the solution was jquery based, but honostly I’m open to most any suggestion.
I would like to apply event tracking in google analytics to facebook comments made
Share
You can use the Facebook JS SDK Event Subscriptions, specifically
comment.createevent callback.You can also track comment deletions with
comment.removeI’ve tested this, and both appear to work reliably. If you have any troubles, try clearing your cache, and be sure to check the Facebook SDK Status Page.
If you’re loading the Facebook SDK asynchronously, those calls should be placed in the asynchronous callback function. If you’re loading the SDK synchronously, they just need to be placed lower on the page than the SDK.
The response object will have the
commentID, as well as ahrefattribute, and aparentCommentID, if the comment is a reply to another comment (otherwise, it is set toundefined).The
hrefattribute’s purpose is unclear, but its contents appear to be composed as follows: