jquery - Is there a callback for Twitter's Tweet Button? -
is there way register callback on twitter's tweet button? i'd able track particular users on site have tweeted link. can't add on onclick event because it's cross-domain iframe. other ideas?
i've seen one way it seems unreliable. their documentation doesn't mention looking work-around.
twitter has web intent events loaded
, rendered
, resize
, tweet
, follow
, retweet
, like
, , click
.
twttr.events.bind( 'tweet', function (event) { // there } );
the behavior changed in fall of 2015 due unreliableness of callbacks happening after event complete.
they triggered when user invokes action in page, rather after action completed.
<script> // performant asynchronous method of loading widgets.js window.twttr = (function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0], t = window.twttr || {}; if (d.getelementbyid(id)) return t; js = d.createelement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.parentnode.insertbefore(js, fjs); t._e = []; t.ready = function(f) { t._e.push(f); }; return t; }(document, "script", "twitter-wjs")); </script> <script> // wait until twttr ready before adding event listeners twttr.ready(function (twttr) { twttr.events.bind('tweet', function(event) { console.log(event); }); }); </script>
Comments
Post a Comment