How to add Event Tracking or SocialTracking?
tordans opened this issue · comments
Tobias commented
How can I add Google Analytics Event Tracking – or even better Social Tracking https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial – to the Link/iFrame?
I want to know how many user click the button.
And maybe also, how many "see" the button (as in "button is rendered on page").
Are there any callbacks that I can use?
Tobias commented
OK, I found it out: I can just add my on onclick events to the provided example link and those attributes will be included in the iFrame-Share-Link as well.
HOWEVER: You need to call the _gaq in the parent frame.
Example:
onclick="
parent._gaq.push(['_trackSocial', 'whatsapp', 'share', YourUrl]);
parent._gaq.push(['_trackEvent', 'social_sharing', 'whatsapp', YourIdentifier]);"
Great!