How to track Tweet Button clicks?

故事扮演 提交于 2019-12-22 01:26:32

问题


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?


回答1:


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.




回答2:


<a style="float:left;position: relative;display: inline-block" target="_blank" href="//twitter.com/intent/tweet?url=http%3A%2F%2Ftechiessolution.com%2Fcss&amp;count=none&amp;source=tweetbutton&amp;text=testing%20Testing%20123%20Title&amp;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);
  });
}



回答3:


What about:

twttr.events.bind('click', function(e){
    // Send GA event
    console.log(e);
});



回答4:


try this

Tracking clicks on social buttons with Google Analytics

http://www.conversionworks.co.uk/blog/2013/05/16/tracking-clicks-on-social-buttons-with-google-analytics/




回答5:


One thought is to generate a UTM'd link for the Twitter button href, then add back into iFrame source page as the href source. This will provide visibility into the click/session/user data on your Google Analytics tracking

To do this, first copy the original hyperlink and use as the source for building the link using the Google link builder. Once generated, come back into the iframe source page and add the new UTM'd link as the href source.



来源:https://stackoverflow.com/questions/4092992/how-to-track-tweet-button-clicks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!