twttr.events.bind.
The Intent Event Object
When a detectable action occurs within a Web Intent or widget, an object representing the event is passed to your JavaScript callback. Intent Event objects include the following data:Intent event object properties
Waiting for asynchronous resources
Loading the widgets.js file asynchronously will require you to wait before binding events: the functions you are calling do not yet exist. You will need to wrap your event bindings in a callback function such as the twttr.ready asynchronous function queue which will be invoked once everything has loaded. All event examples below assume you have wrapped those event bindings in this callback.Available Events
loaded
Occurs aftertwttr.widgets.load has initialized widgets in a page. Includes an array of references to the newly created widget nodes.
rendered
Occurs after an individual widget in a page is rendered. Includes a reference to the newly created widget node. Occurs at the same time asloaded, but for each individual widget. Also triggered when creating a widget with a factory function.
tweet
This event will be triggered when the user clicks a Post Web Intent. Includes a Post in reply to an embedded Post or a Post displayed in an embedded Timeline.follow
This event will populate the followeduser_id or screen_name in the event object’s data argument, depending on the parameters you provided in the web intent.
retweet
This event will populate the original Post that was reposted’ssource_tweet_id in the event object’s data argument.
like
This event will populate the likedtweet_id in the event object’s data argument.
click
Receive an event when the user invokes a Web Intent from within an embedded widget.Example: Detecting events for web analytics
It’s easy to capture these events and pipe them to your web analytics solution. Please note that you’ll need to be using HTTP or HTTPs protocols on the hosting page for these events.Example
Supplemental events resources and examples
- Google Analytics Event Tracking Guide
- Google Analytics SocialWidgetTracker plugin
- X Intent Events with Google Analytics using _gaq.push(); by @nulluk
- An optimized approach to Google Analytics integration by @yahel