We have a browser games portal and would like to measure retention for specific games via Google Analytics.

So, basically, the question we want to answer with data is this one: Of the people who play game X, what % returns to game X within 7 days.

In our case, a game play is a pageview (or an impression with the game name in a custom dimension).

Analytics has User Retention, but as I understand this, it's only on a sitewide level by default.

We tried making custom segments for specific games, but the problem is that we want to access this data programmatically.

Is there a way to achieve our goal via User Retention (ga:cohortRetentionRate) or should we look for a proxy metric?

  • This would be much easier to solve if you had them login with google/facebook/anything before allowing them to play. – Patrick Feb 22 '18 at 12:11
  • @Patrick completely agree but mandatory registration is something not possible in our sector (barrier to start playing must be as low as possible). Once we have our optional login system (working on it), we could use that, but the data will be slightly skewed so ideally we would still find a way to display the data even for the logged out users. – user2449397 Feb 22 '18 at 12:25
  • Maybe we can drop a cookie, and send a custom analytics event when they return. – user2449397 Feb 22 '18 at 12:25

To set this up you'll need two additions to your code:

  1. Set a Cookie value for the game they're playing. Maybe just steal the path. Attach the event to game activation.
  2. Custom event if this cookie is already set and matches the game they're playing.

The code would look like this (after GA container initiation):

var gameID = window.location.pathname; // Example uses a path grab
if (!!$.cookie(gameID)) {
ga('send', {
hitType: 'event',
eventCategory: 'Games',
eventAction: 'replay',
eventLabel: gameID
} else {
$.cookie(gameID, 1, {expires: 7}); // Cookie expires after 7 days.
ga('send', {
hitType: 'event',
eventCategory: 'Games',
eventAction: 'first play',
eventLabel: gameID

Anything can be used for the gameID and custom events can be shortened to:

ga('send', 'event', 'Games', 'first play', gameID);

You can then pull reports based on general first plays, and compare it to replays. This cookie doesn't unset so you'll get multiple hits from the same user on the custom event. If you don't want this, check the cookie value with the 'if' statement and set it on the replay event. So no value=set cookie, 1=replay event, 2=do nothing.

| improve this answer | |

I'm not sure if there is a way to do that in analytics. But what you can do is create a new tracking code and site, and put that tracking code on only the page with the game. That will tell you how many returning users there to that page alone.

| improve this answer | |
  • That doesn't sound like a solution that would work programmatically either. If they have 100 games, they would need 100 tracking codes and they would have to go into each GA account to check on the specific game. – Stephen Ostermiller Feb 22 '18 at 11:03
  • Thanks for the suggestion Michael but Stephen's comment is spot on in our case: it doesn't scale as much as we need it to. – user2449397 Feb 22 '18 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.