JavaScript Tag
#
Including the tagIn order to use the tag in a site, the following snippet is the minimum piece of code that should be
included on the page. It should be added as close to the opening <head>
tag as possible.
This snippet only needs to be included once per page. Refer to Event Collection
if unsure which <JAVASCRIPT_TAG_URL>
to use for your system.
#
Using the tag#
TrackingRecommended parameters:
- clientId: The client id
- siteId: The site id
- type: The event type
The above parameters are recommended, but the data field can be composed by any number of attributes.
For more information about supported events and their required schemas see the Complete list of events by categories.
note
Any provided information not part of the schema of the specific event type will be ignored. If you
need to send additional information not part of a certain event type schema, review the
customFields
field which allows you to pass arbitrary data albeit with restricted capabilities to
interact with the rest of system. If you need to track an event whose type doesn't fit any of the
categories, consider using a Custom event as a last resource.
#
ActivationRequired parameters:
- configId: The string ID of the Activation Trigger.
Optional parameters:
- user: An object containing:
- type: the type of the User Identifier
- id: the id of the user
- reactivationDelay: delay (in milliseconds) until the second activation request is sent. If
0
, no second activation request will be executed. Default value is5000
milliseconds.
All other received data will be ignored.
note
Having a reactivationDelay
is useful for first-time visitors and when the initial activation is
triggered together with other tracking events. These tracking events update the user's profile which
may cause the second request to activate more up-to-date information about the user.
#
CookiesyncRequired parameters:
- cookiesyncId: The string ID of the Cookiesync;
Optional parameters:
- uid: The string ID of the user in the 3rd Party Cookie provider.
All other received data will be ignored.
#
MatchRequired parameters:
- providerId: The string ID of the Match Provider;
- user: An object containing:
- type: the type of the user identifier
- id: the id of the user
Alternatively, you can match multiple user IDs in the same match request by defining user
as an
array of objects with the schema defined above. Example: user: [{type: "email_sha256", id: "id1"}, {type: "crm", id: "id2"}]
.
Optional parameters:
- configId: The string ID of the Activation Trigger to be used when "Allow extra iFrame Activations" is enabled for this Match Provider.
All other received data will be ignored.
#
Advanced usage#
Configuring the tagThe tag comes pre-configured with the correct hosts for your system as well if they're enabled based on your system configuration. However, you can override these values (E.g. use a host alias) in the following way:
#
Setting default data attributes for each event typeUsing the set action, the tag enables configuring default data attributes to be sent for all events of a specific type.