Using JavaScript code and its settings

After installing the script on the pages of the site, you have two global objects

An object

Name

Description

An object

Name

Description

window.SPH

Smart Pixel Helper

Object of settings and initialization of the JavaScript code itself

window.SPM

Smart Pixel Manager

Interface for working with a pixel inside a page

Smart Pixel Helper (SPH) basic settings:

  • cookieName - the name of the Cookie that will store the user ID (default is “ssId“)

  • cookieExpireYears - the lifetime of the user ID cookie stored in the cookieName variable (default 10 years)

  • queryParameter - the value of the GET variable that stores the user ID

By default, the value is “ssId“, if you change this option, the function of the Smart Pixel inside the funnel will be violated, and you will need to manually pass the user ID.

  • timeout - delay value that is used for delayed processing of video elements, forms, since their loading is asynchronous (default value is 3 seconds). The value is specified in millisecond format, for example, 3 seconds = 3000 milliseconds.

Don't set the value too low, because with low latency, not all elements may be captured.

  • identifier - identifier of your pixel for the project

  • baseUrl - base URL used by the system for integration and data transfer

Do not change this value yourself, if the integration is updated by Smart Sender, you will need to change this value

Key Features of Smart Pixel Manager (SPM):

  • fire(name, context) - fires a manual event by name with variables that need to be saved to the client card

  • user.get(): Number|String|Null - returns Smart Sender user ID;

  • user.exists(): Boolean - check for the existence of the Smart Sender user ID;

  • user.set(identifier): void - Specifies the Smart Sender user ID for the current session.сессии.

Examples of using

Script initialization with custom parameters

.... window.SPH = { timeout: 8000, // 8 sec cookieName: 'smartId', cookieExpireYears: 1, identifier: 'SPH-XXXXXX', // enter your Smart Pixel identifiier here baseUrl: 'https://customer.smartsender.eu/pixel', }; ...

Triggering the manual event “demo“ with the user variable “name“ and the value “value“

window.SPM.fire('demo', { name: 'value', });

Getting the user ID

return window.SPM.user.get(); // return '7777'