How to get Analytics from Pley?
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 in the Game Manager
Read about all the analytics available on Pley here!
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 from the Game Site
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.
- Embed the Playable onto a website. (how-to)
- With Javascript, set up the Event Handler for the desired events.
- 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, event.data);
// For example, push to GTM via global dataLayer
window.dataLayer.push({
event: `pley.playable.${event.type}`,
pley: {
playable: {
...event.data,
},
},
});
});
Implementation Example
export interface Events {
event_name: Empty;
purchase_completed: {
amount_usd: string;
};
}
Updated 2 months ago