YouTube Video Interaction-Based Dynamic Content

Display dynamic content based on embedded video interactions, such as play, pause, total watch time, or reaching a specific point in the video.
YouTube video based dynamic content

Try it! Click the play button to see it in action

If-So allows you to display dynamic content based on user interaction with an embedded YouTube video. You can trigger dynamic content based on the following events:

  • Play: When the user clicks the play button.
  • Pause: When the user clicks the pause button.
  • Time: When the video reaches a certain time.
  • Watch time: Based on the total time the user has watched the video.

Step-by-step: How to Display Embedded YouTube Video interaction-based dynamic content

The video watch-based dynamic content functionality relies on the on-page events option. This option necessitates the installation and activation of the Trigger Events extension on the site.

Step 1: Create the dynamic content

  1. Ensure the Trigger Events Extension is installed and active.
  2. In your WordPress dashboard, under ‘If-So,’ create a trigger.
  3. In the default version content field, enter the content you want to display.
  4. Click ‘Publish.’

Step 2: Assign a class to your video.

Add the Class “ifso-youtube” to your video:

  • If you are using a page builder to add your video, assign the class to your video element.
  • If your video is embedded using HTML, add the class to the video iframe tag.

Step 3: Paste the trigger’s shortcode on your page.

Depending on the event at which you want the video interaction-based dynamic content to be displayed, paste the relevant shortcode on your page. You can place it wherever you wish to display the video-based dynamic content.

*Make sure to replace the trigger ID (‘123’ in our examples) with the ID of the trigger you created in step 1.

Play

The dynamic content will be displayed when the user clicks the play button.

[ifso id='123' eventType='youtube' event='play' target='.ifso-youtube']

Pause

The dynamic content will be displayed when the user clicks the pause button.

[ifso id='123' eventType='youtube' event='pause' target='.ifso-youtube']

Time

The dynamic content will be displayed when the video reaches (passes) a certain time.

[ifso id='5127449' eventType='youtube' event='time-watched' time='30' target='.ifso-youtube']
  • If the user skips the set time, the dynamic content will still be displayed.
  • The value of the “time” parameter is in seconds.

Watch time

The dynamic content will be displayed based on the total time the user has watched the video.

[ifso id='5127449' eventType='youtube' event='time-reached' time='30' target='.ifso-youtube']

Categories

Goal

Conversions, Engagement, Sales, User Experience

Topic

Advertising Campaigns, Announcments

Realated templates and examples