Problem #
The server-side Google Tag Manager (sGTM) no longer uses the familiar _ga cookie, but a new cookie called FPID. This is set as “httpOnly” and is therefore not readable by JavaScript. In order for callers to be correctly assigned in reporting, the FPID must be transferred to matelso. Without this adjustment, attribution would be lost. We explain the necessary steps and adjustments below.
Phone tracking & server-side tagging #
Call tracking records the behavior of website visitors who dial a phone number. This allows conclusions to be drawn about which campaigns or channels prompted customers to make a call.
With matelso, each user receives an individual phone number, so that information about the source, campaign, or pages visited is already available when the call is made. Using “Integrations 2.0,” this data can also be fed into Google Analytics 4, where detailed evaluation is possible.
Cookies in sGTM #
With server-side tracking, FPID is increasingly being used as the client ID instead of the classic _ga cookie.
– Previously: _ga in the format GA1.1.134086739.1708512876
– New: FPID in the format FPID2.2.DTB6aPZTYF8heNouSVrjnFHrdPyf7UbPOaZXGU8x+2c=.1709032348
The problem: The FPID cannot be read by JavaScript because the cookie is only visible within the context of server communication. A tracking tool such as matelso Call Tracking cannot therefore query the FPID directly.
If matelso continues to use only the value of the old _ga cookie while GA4 already stores the FPID, incorrect assignments will occur: calls cannot be assigned to a valid user.
Solution: Transfer of the FPID to matelso #
To resolve this issue, the FPID must be forwarded to matelso. The procedure involves three steps:
Step 1: Determine FPID #
The FPID can be queried and output as a response using a custom client template in sGTM. To do this, follow the click path shown in the following screenshots:


You can now give this template a meaningful name. We recommend choosing a meaningful name so that you can easily find the template again later. Next, copy the following code under “Code” and set the following permissions under “Permissions.”
Here is the code
const returnResponse = require('returnResponse');
const setResponseBody = require('setResponseBody');
const setResponseStatus = require('setResponseStatus');
const setResponseHeader = require('setResponseHeader');
const getRequestQueryParameter = require('getRequestQueryParameter');
const getCookieValues = require('getCookieValues');
const log = require("logToConsole");
const fpidcallback = getRequestQueryParameter('fpidcallback');
if(fpidcallback) {
require('claimRequest')();
setResponseStatus(200);
setResponseHeader("content-type", "text/javascript");
setResponseBody(fpidcallback+"('"+getCookieValues("FPID")[0]+"');");
}
Here are the permissions


The template can then be added and activated under the “Clients” menu item.

Once the client has been added, the container can be published. The FPID of the targeted endpoint should also be output.
Step 2: Send FPID to matelso #
In the second step, the FPID is transferred to matelso on the client side.
To do this, a custom HTML tag can be used in Google Tag Manager (web container), which retrieves the FPID from the sGTM server when the page is loaded and passes it on to matelso.
Here is a complete sample snippet:
<script>
function ed_getCookie(cname){
var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1);
if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
}
return "";
};
function matelsoready(FPID) {
FPID = FPID.split(".")[2] + "." + FPID.split(".")[3];
var ga4sessionid = ed_getCookie("_ga_MN66EBC2V8").split(".")[2];
window[window.CallTrackingObject]("addCustomTrackingValues", {
ssgtm_fpid: FPID,
ga4sessid: ga4sessionid
});
}
var scriptTag = document.createElement('script');
scriptTag.src = "https://sst.e-dialog.group/?fpidcallback=matelsoready&x=" + new Date().getTime();
document.body.appendChild(scriptTag);
</script>
This script performs the following steps:
- It retrieves the FPID via the previously created sGTM endpoint.
- It extracts the FPID and GA4 session IDs.
- It passes both values to the matelso CallTracking object via the addCustomTrackingValues function.
This ensures that matelso passes the correct session and user IDs to GA4 for each call.
The script should be executed after loading the matelso tracking (e.g., as a cleanup tag in GTM).
Step 3: Setup in matelso #
To ensure that matelso processes the received values correctly, the variables ssgtm_fpid and ga4sessid must be defined in the matelso integration.
To do this, create a corresponding assignment in the Data Definition Directory (DDD), e.g.:
{{webData.custom.ssgtm_fpid.attribution(FIRSTNOTEMPTY)}}
{{webData.custom.ga4sessid.attribution(FIRSTNOTEMPTY)}}

This allows matelso to use the values passed during call events and forward them to target systems. For social media attribution (e.g., Meta Ads), it is also recommended to transmit the parameters _fbp and _fbc in order to be able to uniquely identify users.
A GA4 integration could look something like this:

Conclusion: #
Because sGTM uses the httpOnly FPID instead of _ga, it must be actively transferred to matelso—otherwise, GA4 attribution will break during calls. With the setup described (FPID endpoint in sGTM, Web GTM snippet, mapping of the variables ssgtm_fpid and ga4sessid in matelso), user and session mapping remains stable; optionally, _fbp/_fbc can be added for social media.
