How to Add Analytics Events?

Both the Pley required events, and custom events needed for your game.

Pley inherently tracks certain events when a user plays your game on the web. However, certain events need to be implemented into each game at the appropriate place. The analytics can be overviewed in the Game Manager, or sent to the service of your choice through the embedded playable.


Automatic Analytics

Most of the analytics gathered by Pley is done automatically; no action or implementation is required. An overview of these events can be viewed in the Game Manager. You can also direct analytics to the service of your choice through your game website. Contact us on [email protected] to learn more.

Sending Pley Game Events

Once the embedded Playable is created, you can listen to events and send them to your favorite analytics provider for insights and attribution. Aside from the analytics you find in the Game Manager, these events are accessible through the embedded playable.

  1. Embed the Playable onto a website. (how-to)
  2. With Javascript, set up the Event Handler for the desired events.
  3. Push events to the analytics service of your choice.

For example, window.dataLayer.push can be used with Google Tag Manager.
Below is an example code snippet of how to do it:

const embed = new Pley.Embed({ /* ... */ });

embed.addEventHandler((event) => {
	console.log("Pley embed event: ", event.type,;

	// For example, push to GTM via global dataLayer
     event: `pley.embed.${event.type}`,
     pley: {
       embed: {,

See the list of events here.

Pley Funnel Events

These methods must be implemented into games before launching on Pley, as the commercial funnel analytics depend on them. These should preferably be implemented to fire only once per game session.


AnalyticsKit.GameLoaded(); should be called whenever the game finishes the initial loading, and the game is interactable for the player. Simply call this method whenever the loading screen is complete.


AnalyticsKit.UserInteracted(); should be called whenever the player takes their first meaningful action in the game, such as clicking a button or taking their first game action. This is often game-specific. Recommended places are:

  • User harvest a resource.
  • User clicks a game button.
  • User moves the camera.
  • User starts a level.


AnalyticsKit.UserEngaged(); should be called whenever the user is considered engaged. This event is up to each game studio themselves to define. Recommended places are:

  • User completes a level.
  • User completes a tutorial.
  • User gains a level or buys an upgrade.
  • User plays for 5 minutes.

What’s Next