Customize event label for Brightcove videos on GTM

84 Views Asked by At

I'm quite new to GTM and have been trying to figure out how to get the video title to populate as the event label? I was trying on the script provided here but I cannot make the event label work; I don't know how to call the video_title in Brightcove.

1

There are 1 best solutions below

1
misterben On

That code isn't using the Brightcove API at all, just attaching event listeners to the video element. It doesn't have any concept of video metadata, like name. You could try replacing this part.

'eventLabel': decodeURIComponent(e.target.currentSrc.split('/')[e.target.currentSrc.split('/').length - 1])

with this

'eventLabel': decodeURIComponent(e.target.parentElement.player.mediainfo.name)