Statistics
Use the Tag Manager (tracking script)
Learn how to use the Fastory Tag Manager to trigger your own HTML, CSS or JavaScript scripts on your experiences, bots and Fanzone, with consent categories and dynamic variables.
The Tag Manager lets you inject your own HTML, CSS or JavaScript scripts into your experiences, your bots and your Fanzone, choosing exactly when they fire. You can connect your analytics tools, advertising pixels or custom styling without ever touching the content of your experiences.
What is it for?
The Tag Manager works like a classic tag manager: you create a script, choose the event that triggers it, then target the experiences or bots it applies to. The script then runs automatically on the player side, at the right moment.
It is the ideal tool to:
- send events to your analytics tools (Google Analytics, Matomo, etc.);
- fire a conversion pixel when a visitor plays a game or wins a prize;
- pass an opt-in reply to your CRM;
- customize the look of an experience with your own CSS.
Since scripts are managed at the workspace level, you can enable, edit or delete them at any time, without changing your experiences.
Access the Tag Manager
The Tag Manager is available as an add-on. Two levels exist:
- Basic Tag Manager: triggers related to experiences and the Fanzone;
- Advanced Tag Manager: adds triggers related to bots (opening, replies, contests, Instant Wins).
Once the add-on is enabled:
- Open your workspace settings.
- In the More section, click Tag Manager.
- The list of your scripts appears, with their title, trigger event, targeting and creation date.
Access to the Tag Manager depends on your role in the workspace. If the page is denied, reach out to an administrator.
Create a script
- From the Tag Manager page, click the Script button at the top right.
- Give your script a title in the Title field. The title is required and limited to 30 characters.
- Choose the consent category in Which category does your script fall into.
- Choose the trigger event in When do you want to trigger the script?.
- Depending on the event, target one or more experiences in In which experience, or one or more bots in In which bot. You can also select All experiences or All bots.
- Paste your code into the editor, using the HTML, CSS or JS tabs.
- Click Validate at the bottom of the panel.
Your script is active immediately on the live experiences you targeted: there is no need to republish your experiences after creating or editing a script.
Available trigger events
Each script is tied to a specific event. Here is the full list.
Events related to experiences and the Fanzone
Available with both the Basic Tag Manager and the Advanced Tag Manager:
Event | When it fires |
When the visitor lands on the experience | When the experience opens |
When the visitor lands on your Fanzone | When the visitor arrives on the workspace's Fanzone |
When the visitor lands on a screen | On every screen change within the experience |
When the game starts | When a game session begins |
When the game ends | At the end of a game session, won or lost |
When the visitor plays a game | On every recorded participation |
When the visitor lands on the winning screen | When the winning screen is displayed |
When the visitor lands on the losing screen | When the losing screen is displayed |
When there is a quiz answer | On every answer submitted in a quiz |
When the visitor clicks a button | On every click on a button in the experience |
Events related to bots
Available only with the Advanced Tag Manager:
Event | When it fires |
When the bot opens | When the bot is opened |
When the bot closes | When the bot is closed |
When there is a reply to the bot | On every reply sent in the bot |
When there is a reply to an opt-in question | When the visitor answers an opt-in |
When the visitor enters a contest | When the visitor registers for the contest |
When the visitor wins an Instant Win contest | When a prize is won |
Consent categories
Each script must be assigned to a category, aligned with the cookie consent notification shown to visitors:
Category | Typical use |
Essential | Scripts required for things to work |
Personalization | Scripts that tailor content to the visitor |
Audience measurement | Analytics and statistics tools |
Design | Styling scripts, available only for the events fired when landing on the experience or the Fanzone |
On the player side, a script only runs if the visitor has accepted the matching cookie category. This is what keeps your tags GDPR compliant. Also note that the chosen category filters the list of available events: the Design category, for example, only offers the landing events.
Insert dynamic variables
Your scripts can include variables that are replaced automatically when the script fires. In the HTML and JS tabs, click Add a variable then choose the variable to insert: it appears in your code as <<variableName>>.
Variables shared by all events:
Variable | Content |
storyId | The story ID |
visitorId | The visitor ID |
visitorEmail | The visitor's email |
brickId | The screen ID |
brickName | The screen name |
currentUrl | The URL visited by the user |
userAgent | The visitor's user agent |
referral | The visitor's referral |
date | The date of the event |
Additional variables are offered depending on the chosen event:
- game end:
gameSuccess(did the player win?),score,personalityScore,successRate;
- game participation:
participation;
- bot events:
sequenceIdandsequenceName;
- reply to the bot:
questionId,questionName,answerValue;
- opt-in reply:
optinValue(the visitor's answer to the opt-in) andoptinName;
- contest entry:
contestId,contestName;
- Instant Win:
rewardId,rewardNameand the prize code.
Example: to send the opt-in reply to your tool, insert <<optinValue>> in your script. When the script runs, the variable is replaced by the actual value, for example true if the visitor ticked the box.
Best practices
- Give your scripts explicit titles, for example
GA4 - game participation, so you can easily find each tag in the list.
- Choose the most honest consent category: an advertising pixel or an analytics tool does not belong in Essential.
- Target your experiences precisely rather than selecting All experiences by default: you will avoid unexpected triggers on future campaigns.
- Always test your script in real conditions: open the published experience, accept the relevant cookie category, then check in your analytics tool that the event comes through.
- Remember to also test the case where consent is declined, to make sure your journey still works.
- Edit or delete your scripts directly from the list: changes apply to live experiences without republishing.
Concrete use cases
If you want to measure participations in Google Analytics, use the participation event
Create a script with the event When the visitor plays a game, category Audience measurement, targeted at your campaign. In the JS tab, send an event to your tool with the storyId and visitorId variables.
If you want to fire a conversion pixel on a win, use the winning screen
Create a script with the event When the visitor lands on the winning screen and paste the pixel provided by your ad network into the HTML tab.
If you want to pass your bot's opt-ins to your CRM, use the opt-in reply
With the Advanced Tag Manager, create a script on the event When there is a reply to an opt-in question and insert the <<optinValue>>, <<optinName>> and <<visitorEmail>> variables into your call.
FAQ
What is the Fastory Tag Manager for?
The Fastory Tag Manager lets you trigger your own HTML, CSS or JavaScript scripts on your experiences, your bots and your Fanzone, without changing the content of your experiences. It is typically used to connect audience measurement tools, conversion pixels or custom styling scripts.
Which events can trigger a script in the Fastory Tag Manager?
Sixteen events are available: landing on the experience, landing on the Fanzone, landing on a screen, game start and end, participation, winning screen, losing screen, quiz answer, button click, plus six bot-related events (opening, closing, reply, opt-in reply, contest entry, Instant Win). Bot events require the Advanced Tag Manager.
What is the difference between the Basic Tag Manager and the Advanced Tag Manager?
The Basic Tag Manager gives access to the events related to experiences and the Fanzone. The Advanced Tag Manager adds the events related to bots: opening, closing, replies, opt-ins, contests and Instant Wins. Both are add-ons enabled at the workspace level.
How do I insert a dynamic variable like optinValue in a Tag Manager script?
In the script editor, in the HTML or JS tab, click Add a variable and select the variable you need. It is inserted into your code as <<optinValue>> and will be replaced by the actual value when the script fires.
Does the Fastory Tag Manager respect visitors' GDPR consent?
Yes. Each script is assigned to a consent category (Essential, Personalization, Audience measurement or Design) and only runs if the visitor has accepted the matching cookie category in the consent notification.
Do I need to republish an experience after creating or editing a script in the Tag Manager?
No. Scripts are managed at the workspace level and applied automatically to your experiences that are already live. The targeted experience simply needs to be published for the script to run.
Why is my Tag Manager script not firing?
Check three things: the targeted experience or bot matches the one you are testing, the chosen event actually happens in your journey, and you accepted the script's cookie category during your test. Also make sure the title was validated and the script appears in the Tag Manager list.