- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
When it comes to integrating Tealium iQ (and just about any tag-based third party vendor) into Flash, we typically divide the world into two pieces. Flash applications that support ActionScript 3.0 and up and those that don't. In this post, we will look at the two different approaches to integrating Tealium iQ into a Flash video player based on the above division.
In the examples below, we will be using the data sources recommended in the "Tracking Video with Tealium iQ" post to build out our tracking calls.
With pre-3.0 versions of ActionScript, there isn't a method for making tracking calls natively from within the Flash environment. Instead, the Flash application will need to make external calls to the web page's JavaScript in order to accomplish the goal of tracking events within the application.
As mentioned previously, with early versions of ActionScript we can't include a native library to handle our tracking calls. So instead, we will make JavaScript calls to the webpage that contains the video player.
Here is the generic structure of that type of call:
getURL(‘javascript’:utag.link
(
{ variable_1:”variable_1_VALUE”, variable_2:”variable_2_VALUE”}
)
’);
Note the following:
Now that we have the generic structure, let's look at how we would attach Tealium iQ (and therefore your analytics tags) to a play button in a video player:
In this example, we assume the simplest execution which is attaching our Tealium iQ call directly to an event on an object in the Flash player. If you have custom event handlers and event listeners built into your Flash player, you may end up building in the Tealium iQ calls as part of those.
playBtn_btn.onRelease = function() {
getURL(‘javascript:utag.link
(
{
//recommended attributes
video_event:”video_play”,
video_name:”My Video Title”, //the name or title of the video
video_type:”standard”, //the type of video
video_position:”0”, //time position of the event in seconds (could also be in milliseconds and should match units used in video_length)
video_length:”60”, //the total length of the video in seconds (could also be in milliseconds and should match units used in video_position)
//optional attributes
video_player:”MyCo Proprietary Player”,
video_category:”My Video Category”,
video_subject:”My Video Subject”
}
)
‘);
Note the following:
Starting with ActionScript 3, Flash started supporting native libraries which enables us to import the Tealium iQ functions directly into the Flash application and make our tracking calls natively from within Flash. To do this we need to:
Import the Tealium iQ ActionScript Library
Our ActionScript library is very small and you could easily download and import it to your Flash player app locally, but in this example we will import the copy that Tealium keeps stored on our CDNs:
//import utag.as from the CDN
include “http://cdn.tealium.com/universal_tag/libs/com/tealium/utag.as”;
Import the utag class
//import the utag class from utag.as
import com.tealium.utag;
Instantiate the Tracking Object
//create the tracking instance
var utagObj:utag = new utag();
Create the Tealium Data Object (utag_data)
//create the data object
var utag_data = new Object();
Populate the Data Object and Trigger the Tracking Event
//populate the data object and trigger the view
playBtn_btn.onRelease = function() {
utag_data.video_event = “video_play”;
utag_data.video_name = “My Video Title”;
utag_data.video_type = “standard”;
utag_data.video_postion = “0”;
utag_data.video_length = “60”;
utag_data.video_player = “MyCo Proprietary Player”;
utag_data.video_category = “My Video Category”;
utag_data.video_subject = “My Video Subject”;
utagObj.handler.trigger(“view”, utag_data);
}
And that's all there is to it. If you have more specific questions about using Tealium iQ from within Flash, please contact your Account Manager to schedule a working session.
Copyright All Rights Reserved © 2008-2023