1.0.13 • Published 2 years ago

storyteq-video-player v1.0.13

Weekly downloads
16
License
ISC
Repository
github
Last release
2 years ago

storyteq-video-player

A VideoJS based player connected with Storyteq API to simplify the loading of video data and tracking video analytics. The player uses the unique hash generated by Storyteq API when creating a video as a reference to load video data and generate analytics.

The analytics are visible in the Storyteq platform CRM Analytics. Please contact us if you haven't received a login yet.

Dependencies

Loading the player into your page is fairly easy, you can include the script directly from our CDN. Make sure to include the script in the head of your page like this:

<script type="text/javascript" src="https://storage.googleapis.com/storyteq-video-player/dist/storyteq-video-player.min.js"></script>

Usage

After loading the script into your page, the player needs to be configured. This is done by defining values for a few parameters in the following fashion:

var videoPlayer = new StoryteqVideoPlayer({
    videoPlayerId : 'player',
    videoParameterName : 'key'
});

Not all parameters are required. Please check out the table below for the full specs of the player.

parametertypedescriptionrequired
videoPlayerIdstringThe id of the HTML-element where the video player should be loaded.yes
videoHashstringThe hash used to directly retrieve the video and send analytics events to.not required if videoParameterName or mediaData is filled
videoParameterNamestringThe name of the query parameter in the current page URL that contains the video hash. For example if your landing page is https://example.com/landing-page?key=d41d8cd98f00b204e9800998ecf8427e, you need to provide key as a value.not required if videoHash or mediaData is filled
mediaDatajsonThe full media data if already previously obtained from the API.not required if videoHash or videoParameterName is filled
dataCallbackFunctionstringThe name of the function which is called after video data has been loaded from the Storyteq API. This video data can for example be used for greeting the visitor with a personal message or prefilling a form. Video data parameter keys are similar to your template parameter keys. Check the dataCallbackFunction in example.html for a working exampleno
verboseboolEnable console logging for the player.no
defaultUrlsobjectDefine fallback URL's for when no hash is provided in the URL.no
posterUrlstringDefine a poster url to override the personalised posterno
noPosterbooleanAllow the player to not load the posterno
autoplaybooleanDefine autoplay (and mute) settings for the player, defaults to trueno
eventsobjectDefine custom eventhandlers for the player by passing a key-value pair object with the event as key and the handler as the value, such as: events: { play: () => {}}no
googleTagManagerobjectDefine your Google Tag Manager configuration to forward video player events to Google Analyticsno

Example

Example of a page that will play the video with the hash passed in the key query parameter: https://example.com/landing?key=d41d8cd98f00b204e9800998ecf8427e

<!doctype html>

<html>

<body>
    <div id="parent">
        <div id="player"></div>
    </div>

    <script type="text/javascript" src="https://storage.googleapis.com/storyteq-video-player/dist/storyteq-video-player.min.js"></script>
    <script>
        var videoPlayer = new StoryteqVideoPlayer({
            videoPlayerId: 'player',
            videoParameterName: 'key'
        });
    </script>
</body>

</html>

Google Tag Manager

It's possible to catch the 'embed' and 'view percentage' events generated by the Storyteq player in Google Tag Manager. To enable this behaviour, add the googleTagManager object to the player configuration:

<script type="text/javascript">
    var videoPlayer = new StoryteqVideoPlayer({
        videoPlayerId : 'player',
        videoParameterName : 'key',
        googleTagManager: {
            enable: true,
            event: 'gtm.storyteq.custom_event',
            eventLabel: 'myCustomLabel',
            eventCategory: 'storyteqVideoPlayer',
        },
    });
</script>

If you wish to send events to Google Analytics, create a custom event with the event name matching googleTagManager.event in the player configuration, if not defined in the configuration, the default value is gtm.storyteq.custom_event. Now create a new tag with type Google Universal Analytics, and set up the event tracking parameters like this:

parametervalue
Category{{eventCategory}}
Action{{eventAction}}
Label{{eventLabel}}
Value{{eventValue}}

Now select the correct Google Analytics account trough the Google Analytics settings. Events should start coming in. If you wish to track an individual (group of) user(s), we advise to dynamically fill the googleTagManager.eventLabel in the player configuration.

Testing

If everything is set up correctly, you can test the player. To create a valid URL, attach the videoParameterName as a GET parameter to your base URL, then add the video's unique hash as a value. For example:

https://example.com?key=9e0627ae3c707b451c9ac8e1408563a1

When you visit your page, the generated video should automatically be loaded.

NOTE: The hash in the example is not functional and cannot be used for testing. Please use the hash of one of the videos created in your own Storyteq account.

Support

If you run into trouble using the player, please contact us.

1.0.13

2 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago