Web Intents tracking for a window.open() pop-up window not working


#1

I’m trying to use Twitter web intents via a Flash application, and none of my event listeners are functioning correctly. Because it is triggered from Flash, I cannot use a normal link, and instead must use Javascript’s window.open(). I have been Googling around, and it seems like this is a problem with opening Tweet windows via window.open().

Is this a solvable issue? Thanks!

<script type="text/javascript" charset="utf-8">
    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"));
</script>

twttr.ready(function (twttr) {

    twttr.events.bind('tweet', function(event) {
        alert('tweet complete');
        // Do something there
    });

    twttr.events.bind('click', function(event) {
        alert('clicked');
        // Do something there
    });
}); 

#2

The event listeners will not function without you letting our own Javascript open the windows for you.


#3

Thanks for the reply! However, could you please explain a little more? I don’t quite understand what you mean.


#4

Our Javascript that captures the events in the popup just cannot be made aware of those events happening without having opened the window itself – web intents are meant to work whether you want to use our javascript or not, but web intents javascript events require that you use our javascript to control the opening of the windows.


#5

Thanks! Could you please refer me to some documentation on how I’d use your Javascript to generate the pop-up?


#6

Taylor, did you see my reply? Sorry for the bump.


#7

If you implement the Tweet Button, Follow Button, or any of the web intents and include our Javascript. When the page loads, our javascript will look for elements like this and automatically add pop-up capabilities when clicked. Within the pop-ups, when the triggerable events happen any callbacks you register will be executed.

In this example, just including the Javascript and building these simple links create pop-ups on on a HTTP or HTTPS connection (and https: to the javascript src there if you’re loading from the filesystem directly).

Reply

Retweet

Favorite


#8

Thanks for getting back to me. What if the button is triggered via Flash? I wouldn’t be able to use an link in that case.


#9

You probably wouldn’t be able to utilize the intent events in that case.


#10

OK, thank you Taylor.


#11

Is any solution has been added to the API for the flash to get the callback of event?


#12