Google Analytics

If you want to track page views or events from your embedded Riddle, you need to listen to events sent out by the Riddle iframe and then trigger Google Analytics events accordingly.

Set up Google Analytics

Here's a guide for how to set up Google Analytics.

Enable Google Analytics

![enable google analytics screen](http://cdn.riddle.com/website/Analytics/enable-google-analytics-screen.webp)

  1. In your Riddle, go to PUBLISH.
  2. Go to Tracking.
  3. Enable Google Analytics 4.
  4. If you have your own custom Objectname, enable Custom Google Analytics configuration and change the default from "gtag" to whatever you are using. Please make sure to only change this if you know what you are doing.
  5. Open Custom event configuration and uncheck events that you do not want to track. The default setting is that all Riddle events except "Send form data" are sent to Google Analytics.
  6. Click on SAVE.

This is the default event we send to Google Analytics if you are using Universal Analytics:

window.dataLayer

dataLayer.push({
    eventCategory: riddleEvent.category,
    eventAction: riddleEvent.action,
    eventName: riddleEvent.name
});

Note: If you are still using the old and outdated Google ga Tag for Analytics, please enable Google Universal Analytics (deprecated) tracking. This is the default event we send to Google Analytics if you are using the deprecated Google Universal Analytics:

window.ga

ga(
    "send",
    "event",
    [riddleEvent.category],
    [riddleEvent.action],
    [riddleEvent.name]
);