Yury Homenok
Yury Homenok

Reputation: 33

embed youtube video in google analytics

I track embed youtube videos in google analytics. I found out that without www in the url video is not tracked. For example, 2 urls that differ only with www. And results are in Chrome. And my question is have I always use www?

Upvotes: 0

Views: 162

Answers (1)

Juan Bravo
Juan Bravo

Reputation: 9

The only thing you need to do is make sure that when a video is first loaded, the page loads the YouTube API library:

script src="https://www.youtube.com/iframe_api"

If your site does lazy-load or otherwise dynamically load videos (e.g. if it’s a single-page app), make sure that the library above is loaded before the first video is added to the site.

Upvotes: 1

Related Questions