webintents - How can I confirm a Twitter web intent was sent? -
i'd confirm user tweeted after clicking twitter web intent. how can accomplish this?
example:
<a href="https://twitter.com/intent/tweet?text=simple+web+intent">tweet</a>
assuming anonymous* user clicks link , tweets, how can confirm this?
ideally i'd love link tweet.
* anonymous
in not authenticated on site , without knowing twitter username
update
this solution no longer works after twitter updated behaviour of widgets. can track if tweet button clicked now, , not if tweet posted.
you can track tweets using 'twttr.events.bind' event listener form twitter api. working example of tracking tweets can found here: http://jsfiddle.net/ez4wu/3/
html:
<a href="https://twitter.com/intent/tweet?url=https://www.webniraj.com/2012/09/11/twitter-api-tweet-button-callbacks/&text=twitter+api:+tweet+button+callbacks"><i class="icon-twitter-sign icon-white"></i> tweet</a>
javascript:
function reward_user( event ) { if ( event ) { alert( 'tweeted' ); console.log( event ); } } window.twttr = (function (d,s,id) { var t, js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js=d.createelement(s); js.id=id; js.src="//platform.twitter.com/widgets.js"; fjs.parentnode.insertbefore(js, fjs); return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } }); }(document, "script", "twitter-wjs")); twttr.ready(function (twttr) { twttr.events.bind('tweet', reward_user); });
my previous solution outdated , no longer appears work.
Comments
Post a Comment