Help menu

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 updateUserData immediately after login
  • After order completion – in the Purchase event 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.

ParameterDescriptionFormat / examplePriority
emUser’s e-mailjan.novak@email.czKey identifier
phPhone number+420606666666Recommended
fnFirst nameJanOptional
lnLast nameNovákOptional
geGendermf or oRecommended
dbDate of birth19870223 (format YYYYMMDD)Optional
ctCityPrahaRecommended
zpPostal code14900Optional
srStreet and house numberUlice 12Optional
countryCountry code (ISO 3166-1 alpha-2)czOptional
regionRegion or state within a federation – for CZ can be a county/district (ANSI/ISO 3166-2 or any string)by (Bavaria), Jihomoravský krajOptional
subscription_idSubscription IDsubscription123Optional

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 (ctregionge…) 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.

Potřebujete další pomoc?

Pokud si stále nevíte rady, obraťte se na naše specialisty. 95 % vašich dotazů umíme vyřešit do 2 hodin.