Google Analytics

Google Analytics has two types for web counters: the old Universal Analytics (ID starts with UA) and the new Google Analytics 4 (ID starts with G). In the builder you can choose one (don't work together).

Attention! Google disables the old format and from July 1 2023, only Google Analytics 4 will work.

Google Analytics 4

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 administrator mode of GA. 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.

Don't forget to enable the Google Analytics 4 option in the plugin settings and select the desired events for data collection.

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(window.gtag && info>100 && !time100){
            gtag("event", "playerjs_time", {"time":"100"});
            time100 = true;
        time100 = false;

Universal Analytics (old type)

If you are using the old Universal Analytics tag type, specify the tracking ID in the module settings (it must start with UA). Since version 10.09, the value of the title variable is used as an event label. since version 12.6, you can also use a separate label variable for this purpose.

19.9.222024 © PlayerJS

Sign up free

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

Restore password

Forgot email? Contact us