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 playable = new Pley.Playable({ /* ... */ });

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

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

Implementation Example

export interface Events {  
  event_name: Empty;  
  purchase_completed: {  
    amount_usd: string;  

See the list of events here.

What’s Next