Track Lexy games in your own analytics
Game starts, answers and scores as Google Tag Manager events and page events, with nothing about the reader.
Your Lexy reports show every play. If your team also measures your site in Google Tag Manager, Google Analytics or another tool, the widget can tell that tool what readers do in a game too: when they start, how each answer goes, and how they finish.
There is nothing to switch on. Once the widget is on a page, it sends these events to that page by itself.
What the widget sends
The widget sends each event in two ways at once:
- To Google Tag Manager: a push to the page's
dataLayer, under the event name in the first column. - As a page event: a
lexy:event on the page, for your own scripts. Its name is in the second column.
| Event name (Tag Manager) | Page event | When it happens |
|---|---|---|
lexy_play_click | lexy:play_click | A reader presses Play on a game card. |
lexy_game_start | lexy:game_start | A game starts on the page: web play, or the gated card opening. |
lexy_call_start | lexy:call_start | A reader uses Call Now to Play and Lexy places the call. The game then happens on their phone, so a phone game sends no answer or finish events to the page. |
lexy_answer | lexy:answer | A reader answers a question, by tapping or out loud. |
lexy_game_complete | lexy:game_complete | A reader reaches the score screen. |
lexy_game_exit | lexy:game_exit | A reader closes a game before the end. |
What each event carries
| Tag Manager field | Page event field | What it is |
|---|---|---|
lexy_widget_id | widgetId | The widget's number, as on My Widgets. |
lexy_game_id | gameId | The game's number. The gated card's questions come from the page, so its events have no game number. |
lexy_game_title | title | The game's title, or the page's title on the gated card. |
lexy_lang | lang | The game's language: en, es, tr or ar. |
lexy_surface | surface | Where it happened: card (a game card), modal (the game window), gated (a gated card in the article) or overlay (a gated card in the corner). |
lexy_play_method | method | online or phone. |
lexy_question | question | Which question, counting from 1. On lexy_game_exit, the question the reader had reached. |
lexy_total | total | How many questions the game has. |
lexy_correct | correct | On lexy_answer: true if the answer was right. |
lexy_score | score | Answers right so far. |
lexy_percent | percent | The score as a share of the questions, 0 to 100. |
A field is left out when it doesn't apply, for example lexy_correct on a game start.
No event carries anything about the reader: no name, email, phone number or account. They describe the game, not the person.
Use them in Google Tag Manager
- In Tag Manager, go to Triggers and click New. Choose Custom Event.
- For Event name, enter one of the names above, for example
lexy_game_complete. To catch every Lexy event with one trigger, enterlexy_.*and tick Use regex matching. - Go to Variables, click New under User-Defined Variables and choose Data Layer Variable. Enter a field name, such as
lexy_score. Make one for each field you want. - Make a tag that uses the trigger, for example a Google Analytics: GA4 Event tag. Set its event name to
{{Event}}and add the variables you made as parameters. - Preview, play a game on your page, and check the events in the preview panel. Then publish the container.
Use them in your own scripts
Every event is also a page event, so your own code can listen without Tag Manager:
document.addEventListener('lexy:game_complete', function (e) {
console.log(e.detail.title, e.detail.score + ' of ' + e.detail.total);
});
Listen on document to hear every Lexy widget on the page. With more than one, e.detail.widgetId tells them apart.
Turn off the Tag Manager push
To keep Lexy out of your dataLayer, add this line to the page before the Lexy script tag:
<script>window.LexyWidget = { dataLayer: false };</script>
The page events still fire, so your own scripts keep working.
Good to know
- Lexy's reports don't depend on these events. Your stats on lexy.fm stay complete even if your tags are off or blocked.
- The events are yours. Lexy doesn't read what your tags do with them.
- They follow the page. A game opened from a share link or a QR code plays on lexy.fm, not on your page, so it sends nothing to your analytics. It still counts in your Lexy stats.
Thanks for letting us know.
Thanks. Write to support@lexy.fm with what you were looking for, and we will answer and improve this page.