At Wistia, we love analytics. While ours are pretty sweet, there are lots of tools out there, like Google Analytics. While Wistia's analytics give you more in-depth information on video plays, putting basic 'video play' stats in Google Analytics can give you a better picture of your web visit metrics.
This guide is here to help you get started integrating Wistia video tracking with your Google Analytics account.
Google Analytics Lab
We realize that sometimes these things can get a bit complex, so to save you some time we built out the Google Analytics Lab. It actually does all of the stuff mentioned below for you! You can check it out here.
We strongly recommend this route if you're not looking for more than the video play, 25/50/75/100% watched, and turnstile conversion events.
If you are still committed to doing it yourself to code out some sweet other alerts, read on!
This lab also works with Universal Analytics, so no worries about compatibility there unless you've changed to a custom analytics variable other than
Before You Get Started
Make sure you have installed the Google Analytics tracking scripts. These are necessary for any custom tracking we do below.
It's worth noting that if you have Universal Analytics, things might be a bit different for you. In that case, you'll want to see this other Google help document where they explain how to set that one up.
If you currently have the pre-Universal Analytics version of Google Analytics setup, we recommend checking out the Universal Analytics Upgrade Center to get all the info you need to know about converting to the shiny new Universal Analytics style of things.
Modify Your Wistia Embed Codes
Integrating with Google Analytics is very simple thanks to the
All you need to do is paste this little snippet of code anywhere on your website,
preferably right before the
</body> tag (meaning at the bottom of your page's body).
You'll need to add the following code snippet to every page that contains a video you want to track. Or better yet, if you have a layout file or a footer that's shared across pages, just put it in there and you'll be good to go!
Due to changes made when Universal Analytics was released, you'll use different code depending on which version you use. The easiest way to do this is to see if you have the
ga variable defined on your website.
Pre-Universal Analytics snippet
1 2 3 4 5 6 7 8 9 10 11 12
Post-Universal Analytics snippet
1 2 3 4 5 6 7 8 9 10 11 12
You'll notice that not only has the variable changed from
ga but that the format between Google Analytics and Universal Analytics is slightly different. Instead of using
.push([...]) you're using
ga('send', ...) to push along that data. Everything else stays the same!
What those snippets do
These snippets fire a 'Play' event to Google Analytics whenever a video on your website is played. They also fires a 'Complete' event when a viewer reaches the end of a video.
We only fire each of these events once per video per page load (that's what the
return this.unbind is for). So if a viewer plays and pauses a video over and
over again, we'll only send one play event to Google. Pretty cool.
You can extend what we've done here to pipe many more events to Google Analytics if you like. Take a look at the Player API to see what's possible.
Track viewing in Google Analytics Dashboard
Now that we have all the back-end coding out of the way, it's time to monitor how the videos are performing on your Analytics Dashboard.
The first step is to navigate to the Event Tracking section. Click the "Behavior" area of the left hand nav bar, and then select "Event Tracking" from the list. The Event Tracking section will show the total number of events, the average number of events per visit, and the Top Events. Select "Categories" to see just the video events.
Using Wistia and Google Analytics is a good way to get all your top-level video analytics data in the same place you already get your other website tracking information.