This guide shows how to load the Kaisa JavaScript (fs.js) using Google Tag Manager.
The goal is simple: Kaisa should see the phone numbers on your pages so it can replace them with Kaisa tracking numbers, and it should only run when your cookie/consent setup allows it.
How Kaisa should fire in GTM
For a healthy setup, we want three things:
The Kaisa tag runs across all pages, not only where numbers should be dynamic in order to capture referrals and maintain session data
It runs at the right time, usually on DOM Ready, when the page content and numbers are visible.
It follows your consent rules (with or without a Consent Management Platform).
If you need details on script order, see:
Kaisa Script loading order
Basic setup in GTM
If you’re not doing anything advanced with consent in GTM yet, you can start with this.
In GTM, create a new tag and select Custom HTML. Name it something like Kaisa – Main Script and paste your snippet:
<script type="text/javascript">
var __fs_conf = __fs_conf || [];
__fs_conf.push(['setAdv', { 'id': 'YOUR_ADV_ID' }]);
__fs_conf.push([
'setParameterString',
'&custnr=CUSTOMER_NR&custname=CUSTNAME'
]);
</script>
<script
type="text/javascript"
src="//analytics.freespee.com/js/external/fs.js">
</script>
Replace YOUR_ADV_ID, CUSTOMER_NR and CUSTNAME with your own values and save.
Now add a trigger to control when this runs. In the tag’s Triggering section, create a new trigger and choose DOM Ready. Leave it as “All DOM Ready events” if you want Kaisa on all pages that use this container.
This is usually recommended so Kaisa can see page views and referrals across the whole site, not just on pages where numbers are replaced.
Consent options
If you use a cookie banner or a Consent Management Platform (CMP) like Cookiebot or OneTrust, Kaisa should follow that setup.
In your case, Kaisa is a marketing cookie. That means:
Kaisa must not run before the user has accepted marketing/analytics cookies.
After the user accepts, Kaisa can run on the pages you’ve configured.
There are two simple parts to this:
In your CMP
Categorise Kaisa under Marketing (or a similar category that is off by default until the user accepts).-
In GTM (Kaisa tag)
You have two options to delay Kaisa until consent:GTM Consent Mode
Custom Event from the CMP
Which option you choose depends on how your team already handles consent in GTM. We don’t prescribe a specific GTM setup, but Kaisa should only run after your chosen marketing consent signal is in place.
This way, the CMP decides when marketing cookies are allowed, and GTM only runs Kaisa after that permission is in place.
More on Kaisa cookies here: How do I define Kaisa Cookies?
Optional: handling “late” consent
If your setup only loads Kaisa after the user accepts cookies, the script may appear a bit later than the initial page load. In that case, Kaisa might miss the moment when the numbers first appeared.
To help with that, you can add this small snippet at the bottom of your Kaisa Custom HTML tag:
<script type="text/javascript">
var waitForKaisa = function () {
if (
typeof(__fs_dncs_instance) != "undefined" &&
__fs_dncs_instance.numberDetection
) {
__fs_dncs_instance.numberDetection();
} else {
setTimeout(function () {
waitForKaisa();
}, 200);
}
};
waitForKaisa();
</script>
This waits until Kaisa has initialised, runs one scan for numbers, and then stops. It’s useful when Kaisa is loaded only after a consent event instead of directly on page load.
Comments
0 comments
Article is closed for comments.