Tweet intent response the same for successful and unsuccessful posts

webintent

#1

It seems that the Twitter web intents tweet event returns a response as soon as the tweet is opened instead of returning a response when the post is actually published. Is there any way to return something once the post is actually published and return null or undefined if the window is closed without the post being published?

I’m binding the tweet event to a click event on several elements on a page like this:

$.each($('a[data-bird].twitter'), function() { //Add tweet href to Twitter buttons on page load
			var $birdName = $(this).attr('data-bird'),
				$birdImage = $(this).attr('data-birdimage'),
				$birdText = $(this).attr('data-twitter');
			$(this).attr('href', 'https://twitter.com/intent/tweet?text=' + encodeURIComponent($birdText) + '+BirdsTellUs.org+%23COP21+' + $birdImage);
		});

		twttr.ready(function (twttr) { //When Twitter is ready
			//console.log('Twitter Ready');

			$('a[data-bird].twitter').on('click', function() {//When Twitter link clicked
				var $birdName = $(this).attr('data-bird'), 
					$socialChannel = $(this).attr('data-smchannel'),
					$trackShare = function() { //Track Twitter sharing function
						dataLayer.push({
							'event':'SMShare',
							'vpurl': $birdName,
							'channel': $socialChannel
					    });
					};
				twttr.events.bind('tweet', function(intentEvent) { //Bind tweet event
					if (!intentEvent) { 
						return;
					} else {
						if ($swapBirds === undefined) { //If no cookies are set
							Cookies.set('shownBirds', $birdName, { path: '' }); //Set cookies
							$swapBirds = Cookies.get('shownBirds'); //Update variable
							$('img[data-bird="' + $birdName + '"]').attr('src', 'img/birds/' + $birdName + '.png'); //Swap image
							$thankYou(); //Show thank you message
							//$showEasterEgg(); //Show easter egg
							$trackShare(); //Track sharing event
						} else { //If cookies are set
							if ($.inArray( $birdName, Cookies.get('shownBirds').split('&') ) !== -1) { //If bird is in array
								return; //Do nothing if image has already been shared
							} else if ($.inArray( $birdName, Cookies.get('shownBirds').split('&') ) === -1) { //If bird is not in array
								Cookies.set('shownBirds', $swapBirds + '&' + $birdName, { path: '' }); //Set cookies
								$swapBirds = Cookies.get('shownBirds'); //Update variable
								$('img[data-bird="' + $birdName + '"]').attr('src', 'img/birds/' + $birdName + '.png'); //Swap image
							}
							$thankYou(); //Show thank you message
							//$showEasterEgg(); //Show easter egg
							//$goToNewSlide(); //Go to easter egg slide
							$trackShare(); //Track sharing event
						}
					}
				});
			});
		});

#2

Correct. The change in event behavior was announced then implemented on November 20.


#3

Hi, i have the same issue. It’s very frustrating. How can we make a real interaction between twitter and our website now ?
I absolutely need to have a callback once the tweet is posted not before, have you a solution ?


#4

Can you please share more details about “absolutely need to have a callback once the Tweet is posted not before?”

How are you currently tracking the success rate today on platforms where the callback will never be available, such as mobile views of your content?


#5

Hi,

I need to make an instant win web app, i used REST API to authenticate the user so i call web intent and need to know if they really post the message on their profile. Before, the event will be triggered when the user publishes a Tweet (either new, or a reply) through the Tweet Web Intent. Now it’s impossible the event return a response on popup opening. I’ve tried to do everything with REST API but the twitter app was always bannished as it was considered like spam because the message post is the same for each account. That’s why i choose to use web intent. Do you have a cleaner way to do that, maybe i miss something with the REST API…


#6

Have you an answer for me about how to do it ?

Thank you


#7

I am sitting in the same boat as cadcatcet. We run multiple sweepstakes applications where we use the Twitter widget. We required the user to share via Twitter (aka Tweet) a pre filled tweet. We relied upon the tweet event to trigger a form submission. This gave us at least at a very minimum, a rough assumption that the user did tweet like we were hoping, thus giving us enough to allow them to enter.

Originally, I had hooked up to the API, but Twitter suspended it due to “spamming”? I still don’t completely understand as to why, since every user authorized us to post the tweet on their behalf.

Anywho, with this Web Intent update, why even have the “Click” event if that is how the “Tweet” event is going to work. Are we able to hook into clicking the actual “Tweet” button of the pop up window?


#8

The click event and tweet event do now fire at the same time.

The distinct names are maintained partly to provide a level of continuity and backwards compatible for many uses of the event, and also so that in more complex widgets (such as embedded Tweets), one can distinguish a click that occurs on the follow button or reply button, for example.

As I said in the other thread, the problem was that in around half of all cases the old tweet event was no longer being fired, and that situation is only going to get worse as iOS and Android adoption continues to increase. The API was broken by circumstances and we can’t maintain that.

For you kind of user case, perhaps the way to approach it would be to use the streaming API to consume Tweets mentioning your account, and use that to confirm someone’s entry into your contest, that way your verification is separate from whatever composer the user has used.

Ben


#9

Hi i have also same problem. In my case twitter sharing button is in a popup. We need after successfully posting these pop up should close. currently after clicking on button our pop up is close but we need after successful posting it should close because this is working as a prevention of downloading my pdf.
Means any one can download the PDF after only sharing my post.But currently without successful sharing he can also download.
So please suggest me any other way for this.


#10

I think @benward’s suggestion above would also work in your case, i.e. listening for the share of your post on something like the use of a hashtag. Unfortunately as Ben and Niall have explained, this isn’t something that is easy to provide as it was before, given the current technical progression and need to support mobile etc.


#11

No one suggesting the way to fix @cadcadcet, @SwarmingDev, @Rohit problem.


Is it possible to confirm a tweet in the Javascript API?
Is it possible to confirm a tweet in the Javascript API?
#12

Seems to be the one of the possible solutions.


#13