User data
Sending user data enables accurate matching of conversions and retargeting audiences even in cookieless environments – for example on mobile devices or in browsers that block third-party tracking.
Why send user data?
The key identifier is the user’s e-mail (em). If you know it (logged-in customer, completed order), SEM will link the event to a specific user even without a cookie present. This increases conversion attribution accuracy and the quality of retargeting audiences across devices.
Other parameters (phone, name, address, gender…) are optional. They can be used as conditions when creating retargeting and conversion lists – for example targeting only customers from a specific city or filtering by gender.
Hashing is automatic
In a frontend implementation (script, GTM template) pass values in plain text. The SEM script will automatically hash them using SHA-256 before sending. The only exception is S2S measurement – there you hash on your own server.
When to send user data?
- After user login – call
updateUserDataimmediately after login - After order completion – in the
Purchaseevent together with order data - Whenever data is available – for example on page load when you know the customer is logged in
User data parameters
All values are of type string. In a frontend implementation send them in plain text – the script handles hashing.
| Parameter | Description | Format / example | Priority |
|---|---|---|---|
em | User’s e-mail | jan.novak@email.cz | Key identifier |
ph | Phone number | +420606666666 | Recommended |
fn | First name | Jan | Optional |
ln | Last name | Novák | Optional |
ge | Gender | m, f or o | Recommended |
db | Date of birth | 19870223 (format YYYYMMDD) | Optional |
ct | City | Praha | Recommended |
zp | Postal code | 14900 | Optional |
sr | Street and house number | Ulice 12 | Optional |
country | Country code (ISO 3166-1 alpha-2) | cz | Optional |
region | Region or state within a federation – for CZ can be a county/district (ANSI/ISO 3166-2 or any string) | by (Bavaria), Jihomoravský kraj | Optional |
subscription_id | Subscription ID | subscription123 | Optional |
The updateUserData method
Send user data using SEM('updateUserData', userData). Call it whenever data is available – ideally immediately after user login or on page load when you know the customer is logged in.
const userData = {
em: "jan.novak@email.cz", // hashed automatically
ph: "+420606666666",
fn: "Jan",
ln: "Novák",
ge: "m",
db: "19870223",
ct: "Praha",
zp: "14900",
sr: "Ulice 12",
country: "cz"
};
SEM('updateUserData', userData);
If you are only sending an e-mail, a minimal variant is sufficient:
SEM('updateUserData', { em: "jan.novak@email.cz" });
Sending together with an event
User data can be set once using updateUserData and then events sent normally – the data will be attached automatically. Alternatively it can be passed directly in the event body. Both approaches are equivalent.
// Call immediately after the user logs in
if (isLoggedIn) {
SEM('updateUserData', {
em: currentUser.email
});
}
// Subsequent events are automatically linked to this user
SEM('track', 'ViewContent', { /* ... */ });
S2S measurement – hash yourself
With Server-to-Server measurement you must hash personal data using SHA-256 on your own server before sending to Sklik. The result is a 64-character hexadecimal string.
Normalize values before hashing
- E-mail: convert to lower case, strip leading and trailing spaces
- Phone number: use E.164 format (e.g.
+420606666666) - First name, last name, city: lower case, diacritics do not need to be removed
Node.js
const crypto = require('crypto');
function hashValue(value) {
return crypto
.createHash('sha256')
.update(value.trim().toLowerCase())
.digest('hex');
}
const userData = {
em: hashValue('jan.novak@email.cz'),
ph: hashValue('+420606666666'),
fn: hashValue('jan'),
ln: hashValue('novák'),
};
PHP
function hashValue($value) {
return hash('sha256', strtolower(trim($value)));
}
$userData = [
'em' => hashValue('jan.novak@email.cz'),
'ph' => hashValue('+420606666666'),
'fn' => hashValue('jan'),
'ln' => hashValue('novák'),
];
Python
import hashlib
def hash_value(value):
return hashlib.sha256(value.strip().lower().encode()).hexdigest()
user_data = {
'em': hash_value('jan.novak@email.cz'),
'ph': hash_value('+420606666666'),
'fn': hash_value('jan'),
'ln': hash_value('novak'),
}
Use in retargeting and conversions
Geographic and demographic parameters (ct, region, ge…) can be used as conditions when creating retargeting lists and conversions in the Event Management section. For example:
- Retargeting list only for customers from Prague → condition
ct = Praha - Conversions only for women → condition
ge = f - Combined: customers from Brno who viewed the “Televize” category
Conditions within a single event are evaluated against objects in the contents array – a combination of parameters always applies within one object (AND logic inside an object, OR logic across objects). See the Dynamic retargeting section for more.
E-mail hashing guide (EID)
A detailed technical description of correct hashing for S2S can be found at vyvojari.seznam.cz/identita/eid.