Documentation
Pixel interception and identifier synchronization
The goal of this section is to obtain visitor identifiers in third-party services so that data can later be linked server-to-server. In the current version of the Web-SDK this is done in two ways.
Automatic synchronization with GA4 and Yandex Metrica#
If Google Analytics 4 or Yandex Metrica are connected on the page, the SDK obtains their client id on its own,
sends an internal user_params event, and saves the values in storage. From then on they arrive
in the user block of every message:
"user": {
"ga4ClientId": "2039255293.1537236640",
"ymId": "1537242943246737376"
}
There is nothing to configure. For synchronization to be in time, it is best to place the Rockstat snippet above the GA4 and Metrica counters.
Identifiers from your own code#
Any identifier you obtain on the site side is passed through identify and
ends up in the user block of all subsequent messages:
rstat4('identify', { hybridPid: 'xxxxxxxxx' });
More in the JavaScript API.
The pixelSync parameter#
The pixelSync parameter and interception of the addresses of loaded pixels are reserved and do not
work in version 5.x. The configuration below describes the intended behavior and is provided for compatibility
with previous versions of the documentation.
The idea: the SDK looks at the addresses of pixels loaded on the page, extracts an identifier from them with a regular expression, and saves it in the specified user parameter.
pixelSync: {
patterns: [
['https://dss-us\\.hybrid\\.ai/Pixel/Track2.*pid=([0-9a-z]+)', 'hybridPid']
]
}
The result would be equivalent to calling rstat4('identify', { hybridPid: '...' }).