I want to track tweet button clicks via Google Analytics, but tweet button is an iframe with content from another domain. Is there some tricks to add callbacks for tweet button click?
Or.. u can simply add event to your div and wait when this div well be clicked, like a:
<div class="clickMe">
//twitter button there
</div>
<script>
$('clickMe').click(function(){
//my awesome code there
})
</script>
Sure, if you need only click, not callback.
<a style="float:left;position: relative;display: inline-block" target="_blank" href="//twitter.com/intent/tweet?url=http%3A%2F%2Ftechiessolution.com%2Fcss&count=none&source=tweetbutton&text=testing%20Testing%20123%20Title&original_referer=techiessolution.com">Tweet</a>
if (typeof twttr === "undefined") {
$.getScript("//platform.twitter.com/widgets.js", function () {
function handleTweetEvent(event) {
if (event) {
console.log(event['target']);
}
}
twttr.events.bind("tweet", handleTweetEvent);
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With