1. Home
  2. Platform Administration
  3. User Management
  4. How to Use Dispatch Jukebox Events

How to Use Dispatch Jukebox Events

This functionality allows developers to tap into the in-browser events of our Jukebox tracking script.

First, the following Javascript must be enabled on the page you wish to tap into events on. For Content Tracks and Explore Pages add the following code as External Code and enable on the Content Tracks and Explore Pages you wish to tap into.

For Chrome and Firefox

handleJukeboxDispatchedEvents = event => {
        switch (event.detail.eventName) {
          case "load_show":
            // Add custom code here.
            console.info('Load Show Event', event.detail);
            break;
          case "mouse_move":
            // Add custom code here.
            console.info('Mouse Move Event', event.detail);
            break;
          default:
            // Other events not handled are caught here.
            console.info('Other Event', event.detail);
            break;
        }
      };

      window.addEventListener("pf_event", this.handleJukeboxDispatchedEvents, false);

For Internet Explorer

 

handleJukeboxDispatchedEvents = function(event) {
        ...
      };
      
      window.addEventListener("pf_event", this.handleJukeboxDispatchedEvents, false);

The events in the case statement are any event from EventNames.js, which are listed below. For example, you can replace “load_show” or add to the case statement. This is a list of valid events as of April, 2020 and some may be deprecated or new events added over time.

"capture_show"
"capture_hide"
"click_content"
"click_call_to_action"
"click_email_show"
"click_email_hide"
"click_facebook"
"click_hide"
"click_download"
"click_like"
"click_linkedin"
"click_next"
"click_previous"
"click_show"
"click_twitter"
"click_unlike"
"exit_show"
"hover_call_to_action"
"load_show"
"mouse_move"
"return_after_title_change"
"scroll_hide"
"scroll_show"
"submit_external_form"
"submit_form"
"tab_blur"
"tab_focus"
"time_show"
"title_change"
"window_close"
"cookie_consent_opt_in"
"cookie_consent_opt_out"
"overlay_open"
"overlay_close"
Updated on August 17, 2022

Was this article helpful?

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
CONTACT SUPPORT