Google Analytics


Place the standard analytics code on the player page as a Global tag (gtag.js) — this code can be found in the configuration assistant, which is available in GA administrator mode. The player will use it to send events. These events will appear in the Events and Engagement / Events section and will be included in reports within 24 hours after integration is enabled.

You can select the necessary events for data collection in the plugin settings (by default, only the start of playback is enabled).

With PRO you can also collect ad events (start, skip, and click on ads).

Segmentation of events

You can segment all events by some attribute. By default, the player uses the content title, if it exists. You can also specify your own attribute with the label option.

new Playerjs({id:"player", file:"video.mp4", label:"customer#123"});

You can specify other parameters with the galabels object from version 15.1

new Playerjs({id:"player", file:"video.mp4", galabels:{my_param1:"123", my_param2:"abc"}});

To make this work, you need to find the Create custom dimensions button in the Google Analytics event settings and add the label dimension. In this case, a separate block with data for this parameter will appear for events.

How to collect other events

You can use the JS API to collect other player events, there are many more. For example, you can send an event to GA that the user has played up to 100 seconds.

let time100;
function PlayerjsEvents(event,player,info){
    if(x=="time"){
        if(window.gtag && info>100 && !time100){
            gtag("event", "playerjs_time", {"time":"100"});
            time100 = true;
        }
    }
    if(x=="new"){
        time100 = false;
    }
}

20.0.1
2024 © PlayerJS

Sign up

Sign up
By signing up, you agree to Terms of Service
Login if you have an account

Restore password

Restore
Forgot email? Contact us