Adobe Launch extension update: YouTube Playback v1.2 - enable tracking in a Rule action

About two months ago, my extension, YouTube Playback, was released on Adobe Experience Platform Launch (or Adobe Launch, for short). (Read the blog post announcing its v1.0 launch.)

Since that time, it has been used in a couple of Properties, which is far fewer than I'd prefer, but I'm expecting it to grow in usage over time.

YouTube playback extension for Adobe Launch

Well, now, there's an even better reason to use it to track your YouTube video playback in Adobe Launch. Version 1.2.0 was released about a week ago, and it's what I would really consider the "real version 1" because of one key feature:

  • Enable YouTube playback tracking within a Rule, instead of only at window load.

This is an immense development. Previously, my extension would only enable YouTube playback tracking for videos that were loaded with the current web page. But if your YouTube videos were loaded dynamically, for instance, when a user clicked a button, then my extension would fail to track that video.

Not any more!

Enable YouTube playback tracking with a Rule action

So now, you can track your YouTube videos' playback no matter how they are loaded in your page! You can still load them with a "Window Loaded" event (which is how it has always been loaded).

Or you could load your YouTube videos dynamically, then run this Rule action to enable video tracking with them. Here's an example of how you could do that:

In your web page's code that loads the YouTube video dynamically, add a Custom Event at the end:

var youtubeVideo = document.createElement('iframe');
youtubeVideo.src = "https://www.youtube.com/embed/..."; // the YouTube embed URL

youtubeVideo.addEventListener('load', function() {
  // dispatch a Custom Event for Adobe Launch to detect
  var videoLoadedEvent = new Custom Event('YouTube video loaded');
  this.dispatchEvent(videoLoadedEvent);
});

// insert the YouTube video inside a particular <DIV> element
var placeholder = document.getElementById('youtube_video_placeholder');
placeholder.appendChild(youtubeVideo);

Then, in Adobe Launch, create a Rule with a Custom Event event type that listens for the "YouTube video loaded" event, and add the "Enable video playback tracking" action from my extension.

(If you're not familiar with Custom Events, not to worry. You can also use a Direct Call to perform the above function too.)

If you discover any errors with the extension, or if you have a neat idea that I should incorporate, please open an issue at my GitHub repository.

Also, read the the blog post about the v1.5 update!

Comments

Popular posts from this blog

How to "unpivot" a table in BigQuery

Adobe Analytics and Google Analytics terminologies cheat sheet

Querying Google Analytics data as flat tables from BigQuery: The Definitive Guide and Recipe