Yandex Metrica
This integration has
@beta status. Follow the player changelog
.The player can send viewing events to Yandex Metrica. Create a goal in your counter and enable the integration in the player or through the API.
Configure a goal in Metrica
Add a goal in the counter settings:
| Field | Value |
|---|---|
| Name | Any clear name |
| Condition type | JavaScript event |
| Goal ID | Exactly kinescope.video_event |
Enable the integration in the player
In the dashboard: enable the Yandex Metrica integration in the player settings and enter the counter ID.
Through the IFrame API: pass the counter ID in settings.yandexMetrics when you call create()
:
playerFactory.create('player', {
url: 'https://kinescope.io/VIDEO_ID',
settings: { yandexMetrics: '000000000' },
})
Integration script for iframe
If the player runs in an <iframe> through simple embedding
or the IFrame API
, add:
https://player.kinescope.io/latest/iframe.ym.js
Place the script after the Yandex Metrica code. Without it, iframe events do not reach Metrica.
Simple embedding example
<head>
<!-- 1. Yandex Metrica -->
<script>
// Counter initialization code from the Metrica interface
</script>
<!-- 2. Integration script after Metrica -->
<script src="https://player.kinescope.io/latest/iframe.ym.js"></script>
</head>
<body>
<iframe
src="https://kinescope.io/embed/VIDEO_ID"
allow="autoplay; fullscreen; picture-in-picture; encrypted-media; gyroscope; accelerometer; clipboard-write; screen-wake-lock;"
style="border: none;"
></iframe>
</body>
In this setup, enter the Metrica counter ID in the player settings in the dashboard.
IFrame API example
<html>
<head>
<!-- 1. Yandex Metrica -->
<script>
// Yandex Metrica initialization code
</script>
<!-- 2. Integration script after Metrica -->
<script src="https://player.kinescope.io/latest/iframe.ym.js"></script>
<!-- 3. IFrame API -->
<script>
function onKinescopeIframeAPIReady(playerFactory) {
playerFactory.create('player', {
url: 'https://kinescope.io/VIDEO_ID',
settings: { yandexMetrics: '000000000' },
})
}
</script>
<script async src="https://player.kinescope.io/latest/iframe.player.js"></script>
</head>
<body>
<div id="player"></div>
</body>
</html>
Next steps
- Google Analytics — send player events to GA4 and GTM
- Simple iframe embedding
- Create a player
— configure the
settingsparameter