Save Client
<script>
SP.go('saveClient', {
firstname: "CUSTOMER-NAME",
city: "CUSTOMER-CITY",
email: "CUSTOMER-EMAIL"
})
</script>You save information about the client, so it can be used later, e.g. when purchasing.
Identifying users
Every visitor gets an anonymous Trustisto ID, stored in a first-party cookie. When you save an email or a phone, the visitor becomes a known client: Trustisto connects the anonymous ID with that e-mail or phone, so the visits, baskets and purchases of the same person on other devices or browsers end up in one client profile.
Call saveClient as soon as you know who the user is, e.g. after they log in, register or fill in a form.
Fields
<script>
SP.go('saveClient', {
firstname: "CUSTOMER-NAME",
lastname: "CUSTOMER-LASTNAME",
city: "CUSTOMER-CITY",
email: "CUSTOMER-EMAIL",
phonePrefix: "+48",
phone: "CUSTOMER-PHONE",
"consent.mail": true,
"marketing.mail": true
})
</script>firstname,lastname,city- basic client detailsemail- lowercased and trimmed; an invalid e-mail is droppedphone- 6 to 9 digits, optionally with a country prefix (e.g.+48123456789); spaces are removed and an invalid phone is droppedphonePrefix- the country prefix of the phone, e.g.+48consent.mail,consent.phone- general consent to communicate with the client over the given channelmarketing.mail,marketing.phone- consent to send marketing content to the client over the given channelcouponCode- the coupon the client applied; kept only in the browser and added to the order on the Thank You Page, see Coupon Codes- any other key - saved as a custom field, if a custom field with that name is defined for your website in the panel
Consents
Consents are set per channel: mail and phone. Use the <consent>.<channel> key with true or false:
<script>
SP.go('saveClient', {
email: "CUSTOMER-EMAIL",
"marketing.mail": true,
"marketing.phone": false
})
</script>You can also pass consent: true or marketing: true without a channel. Such a value is applied to every channel the client already had before this call (mail if they had an e-mail, phone if they had a phone), so when you save the e-mail or phone in the same call, use the per-channel keys.
Arguments
SP.go('saveClient', params, overwrite, sendTrigger)params- the client fields (see above)overwrite-true(default) replaces fields the client already has;falseonly adds the fields that are missingsendTrigger-true(default) informs Trustisto about the change, so it is synced and can trigger campaigns;falseonly saves the data in the browser