The HTML5 Video Tracking tag assumes that there is a title attribute present on the <video> element, however in the case of Wistia this is not true. There is no way, using Wistia’s embed code, to include a data-video-title attribute.
Wistia injects JSON+LD in the <head>, and that is where the video title is rendered. Example:
Might I suggest that rather than assuming an HTML attribute to fetch the title, we modify to either allow a variable OR a CSS selector for the title? This would still allow the HTML title attribute to be used if present, but also allow for more flexibility around where the title is fetched from.
In the case of JSON+LD, the title can be accessed using:
Below is the Google Tag Manager recipe (contains tags, triggers, variables) for tracking Wistia Videos via HTML5. I believe this could easily be modified by the Piwik team and added to the official libray of Piwik tags. It leverages the Wistia JavaScript API
Any progress on this? We’re trying to implement Wistia tracking now but nothing seems to be arriving in Analytics although the tag we’ve got is firing correctly.
… I tried to see what the HTML tag from this recipe does but when I try it in the console on a page like your example or others like a Wistia demo page (Watch Product Demo | Wistia Video Platform)… seems to work
If you want to get rid of the code that sends data directly to gtag / GA and just want to execute the whole function when a player is found on the page (the recipe does that by using a custom JS variable and a trigger with condition) you can use the tag code that I used in the console for testing on the pages mentioned above: wistia HTML5 video Events to dataLayer · GitHub
@mbaersch Thanks for those links - most helpful
Through a combo of your code, a few tweaks on our side to make it prevalent to the business and watching debugger like a hawk, we’ve finally got the Wistia videos coming through with all actions/fields we’d like to report on showing in Analytics.
I should note that the HTML5 Video template does work fine with the CSS selector turned on but the title of the video passed through seems to be an ID of some sort, so not very useful, hence the workaround to get DataLayer objects.