Documentation Index

Fetch the complete documentation index at: https://docs.supermetrics.com/llms.txt

Use this file to discover all available pages before exploring further.

Tracking in the _st module

Prev Next

The _st.tracking module handles all user tracking functionality within the Data Activation tag management system. Use these methods to track page views, engagements, conversions, and external facts, as well as to manage user identifiers and cookie syncs with partner platforms.

This article also covers the underlying tracking API endpoints. You can use the endpoints directly without the base script for implementations such as native mobile apps where JavaScript isn't available.

Methods overview

Method

Description

_st.tracking.sendPageview(url)

Sends a page view event.

_st.tracking.sendEngagement(engagementType, customProperties)

Sends an engagement event with an optional content string and custom properties.

_st.tracking.sendConversion(transactionValue, transactionId, products, customProperties)

Sends a conversion event.

_st.tracking.sendExternalFact(factName, ttl, params, forcedImport)

Sends an external fact to the profile.

_st.tracking.storeMapping(partnerType, identifier, mergeOperator, forceMapping)

Stores an identifier mapping for a partner.

_st.tracking.syncPartner(partnerId)

Initiates a cookie sync with a partner platform.

_st.tracking.getUserIdentifier()

Gets the unique identifier for the current user.

_st.tracking.resetUserIdentifier()

Resets the user's profile identifier.

_st.tracking.getConversionValue()

Gets the conversion value set for this user.

_st.tracking.getConversionProducts()

Gets the products linked to this user's conversion.

_st.tracking.getTransactionId()

Gets the transaction ID linked to this user's conversion.

Method details

_st.tracking.sendPageview(url)

Sends a page view event. This collects session information used for data exports and session tracking.

Parameters:

  • url (string, optional): A URL to use instead of the current document location.

Example:

_st.tracking.sendPageview();

_st.tracking.sendEngagement(engagementType, engagementContent, customProperties)

Sends an engagement event. You can pass just the engagement type, the type and custom properties, or you can include an engagement content string as the second argument.

Parameters:

  • engagementType (string): The type of engagement.

  • engagementContent (string, optional): Specific content related to the engagement.

  • customProperties (object, optional): Key-value pairs of custom properties.

Examples:

// With type and custom properties only
_st.tracking.sendEngagement('ProductView', {'productId': '1630'});

// With type, content string, and custom properties
_st.tracking.sendEngagement('VideoPlay', 'ProductDemoVideo', {'videoLength': '120'});

_st.tracking.sendConversion(transactionValue, transactionId, products, customProperties)

Sends a conversion event. The first argument is always the transaction value. Because the value only accepts an integer, pass the value in cents.

Parameters:

  • transactionValue (integer): The value of the conversion in cents.

  • transactionId (string, optional): A unique identifier for the transaction, used to prevent duplicate conversions.

  • products (array or string, optional): Products associated with the conversion.

  • customProperties (object, optional): Key-value pairs of additional custom properties.

Example:

_st.tracking.sendConversion(10000, 'abc', 'creditcard', {'cardType': 'platinum'});

_st.tracking.sendExternalFact(factName, ttl, params, forcedImport)

Sends an external fact to a user profile. Facts are added and updated based on their name. When a fact is updated, all its property names and values are renewed.

If a fact property can sometimes be empty, pass an empty string for that property rather than omitting it. This makes audience conditions more predictable.

Parameters:

  • factName (string): The name of the fact. This must match the name configured in Data Activation under Profiles > External facts for the fact to be usable in audiences.

  • ttl (integer): Time to live in seconds. Minimum is 60 seconds, maximum is 20 years. After this time, the fact is removed from the profile.

  • params (object): The fact properties as key-value pairs.

  • forcedImport (boolean, optional): When the same fact is sent twice, it isn't updated unless forcedImport is set to true. Set to true to also update the TTL.

Example:

_st.tracking.sendExternalFact('LastProduct', 157784630, {'LastProduct': '1630', 'SecondProduct': '1631'});

_st.tracking.storeMapping(partnerType, identifier, mergeOperator, forceMapping)

Stores an identifier mapping for a partner, optionally merging with existing profiles that contain the same identifier. By default, the mapping runs once every 14 days per visitor.

Parameters:

  • partnerType (integer): The partner type or slot number. See Data Activation partner types and partner numbers for available values.

  • identifier (string): The identifier to map to the profile.

  • mergeOperator (integer, optional): Set to 0 (default) to map only, or 1 to merge back into any existing profiles that contain this identifier.

  • forceMapping (integer, optional): Set to 1 to force a mapping outside the normal 14-day cycle. Defaults to 0.

Example:

_st.tracking.storeMapping(2001, '123456789', 1);

_st.tracking.syncPartner(partnerId, customProperties)

Initiates a cookie sync with a partner platform. The sync runs once every 14 days per visitor. You can optionally pass a custom properties object.

Parameters:

Example:

_st.tracking.syncPartner(7, {'userTier': 'premium'});

_st.tracking.getUserIdentifier()

Gets the unique identifier for the current user. If the user doesn't have an identifier yet, the method creates one and saves it in a cookie.

Returns: A UUID (type 1) representing the user.

_st.tracking.resetUserIdentifier()

Resets the user's profile identifier. This doesn't erase previously stored profile data — the existing data remains, but a new identifier is assigned and tracking starts fresh. Use this when you're certain you're dealing with a different visitor on a shared device.

_st.tracking.getConversionValue()

Gets the conversion value set for the current user. Only available after a conversion has been set.

Returns: The conversion value linked to this user.

_st.tracking.getConversionProducts()

Gets the array of products linked to the current user's conversion. Only available after a conversion has been set.

Returns: An array of products linked to this user's conversion.

_st.tracking.getTransactionId()

Gets the transaction ID linked to the current user's conversion. Only available after a conversion has been set.

Returns: The transaction ID linked to this user's conversion.

Tracking API endpoints

The following endpoints are called by the base script tracking methods. You can also use them directly — without implementing the base script — for example in a native mobile app.

When using the base script, a UUID is generated automatically. If you're calling the endpoints directly, your implementation must generate a UUID and keep it consistent across sessions. The format must be exactly 8-4-4-4-12 characters between dashes, for example: 522a5323-b3ff-44df-8624-a22edf8d2800.

Page view

Called by _st.tracking.sendPageview(). Collects session information for data exports and session tracking.

Example endpoint:

https://t.svtrd.com/t-1232?i=522a5323-b3ff-44df-8624-a22edf8d2800&u=URL&s=REFERRER&p=true&pn=false&cb=1585157206208

Parameter

Description

t

Your site ID.

i

The UUID for this user.

u

The URL of the current page.

s

The referrer URL.

pn

true if this is the start of a new session, false otherwise.

cb

A randomly generated cache buster.

Engagement

Called by _st.tracking.sendEngagement().

Example endpoint:

https://t.svtrd.com/t-1232?i=522a5323-b3ff-44df-8624-a22edf8d2800&e=true&et=ProductView&cup=productId%3A1630&cup=categoryId%3A249&cb=1585157341997

Parameter

Description

t

Your site ID.

i

The UUID for this user.

et

The engagement type name.

cup

One parameter per custom property, in the format propertyName%3ApropertyValue. You can include up to 64 custom properties.

cb

A randomly generated cache buster.

External fact

Called by _st.tracking.sendExternalFact().

Example endpoint:

https://t.svtrd.com/t-1232?i=30154a8e-67ec-4437-8fde-d673c93090b5&f=true&ft=LastProduct&fttl=157784630&cup=LastProduct%3A1630&cup=SecondProduct%3A1631&cb=1585158995960

Parameter

Description

t

Your site ID.

i

The UUID for this user.

ft

The name of the fact.

fttl

Time to live for the fact in seconds.

cup

One parameter per fact property, in the format propertyName%3ApropertyValue. You can include up to 64 properties.

cb

A randomly generated cache buster.

Conversion

Called by _st.tracking.sendConversion(). Send this on the conversion confirmation page.

Example endpoint:

https://t.svtrd.com/t-1232?i=8e30b656-d70d-4b24-8a64-ab4162def667&c=true&cv=10000&ti=abc&cp=creditcard&cup=cardType%3Aplatinum&cb=1585070080817

Parameter

Description

t

Your site ID.

i

The UUID for this user.

cv

The conversion value in cents.

ti

The transaction ID, used to prevent duplicate conversions.

cp

The conversion product.

cup

One parameter per custom property. You can include up to 64 custom properties.

cb

A randomly generated cache buster.

Store mapping

Called by _st.tracking.storeMapping(). Adds an identifier to a profile and optionally merges with existing profiles that contain the same identifier. The mapping runs at most once every 14 days per visitor.

Example endpoint:

https://t.svtrd.com/syncResponse?ca_site=1232&ca_partner=2001&ca_cookie=30154a8e-67ec-4437-8fde-d673c93090b5&ca_read=pid&pid=123456789&cb=1585160566364&ca_merge=1

Parameter

Description

ca_site

Your site ID.

ca_partner

The partner type to map an ID to.

ca_cookie

The UUID for this user.

pid

The identifier to map to this profile.

cb

A randomly generated cache buster.

ca_merge

0 to map only. 1 to merge with existing profiles that contain this identifier.

Opt out

Opts a user out of remarketing, audience adaptation, or both. Note that this doesn't delete any profile data.

Example endpoint:

https://t.svtrd.com/t-1232?i=30154a8e-67ec-4437-8fde-d673c93090b5&up=true&upr=true&upa=true&cb=1585161574517

Parameter

Description

t

Your site ID.

i

The UUID for this user.

upr

true to drop this profile from all configured audiences.

upa

true to keep the profile in audiences but remove it from all configured connectors.

cb

A randomly generated cache buster.

Sync partner

Called by _st.tracking.syncPartner(). Initiates a cookie sync with a partner. The sync runs at most once every 14 days per visitor.

Example endpoint:

https://t.svtrd.com/s-1232?i=c9962550-1ef2-4028-99bf-4d01b400d1ab&partnerId=7&secure=true&cb=1585157000841

Parameter

Description

s

Your site ID.

i

The UUID for this user.

partnerId

The partner slot ID for the partner to sync with.

cb

A randomly generated cache buster.