Once the data activation base script has been loaded into a website, you’re able to use the synchronous framework by calling, for example:
_st.data.getProperty('test').However, if you want to, for example, add some properties to the framework, while the script hasn't necessarily been loaded yet (due to an asynchronous execution), you can use the _st object to queue commands to our framework.
Example basescript
(function(a,d,e,b,f,c,s){a[b]=a[b]||function(){a[b].q.push(arguments);};
a[b].q=[];c=d.createElement(e);c.async=1;c.src="//tdn.r42tag.com/lib/"+f+".js";
s=d.getElementsByTagName(e)[0];s.parentNode.insertBefore(c,s);})
(window,document,"script","_st", "9999-v1");
// Add additional settings here (optional)
_st('setPageStructure', 'default|structure');
_st('addTagProperty', 'exampleLocal', 'property');
_st('addTagProperties', {'example': 'property', 'otherExample': property});
_st('addLocalTagProperties', {'exampleLocal': 'property', 'otherLocalExample': property});
_st("loadTags");Explanation
Loading the actual script is the last step op the process. Therefore, the given commands are queued and executed from that queue (_st()) after loading the actual script.
The _st() command queue doesn't provide the user with the entire API, though. The available commands to queue are listed below.
Available functions
Function | Arguments | Description |
|---|---|---|
| 1 to N: | Identify the current page; components are used to form a tree structure. |
| 1: name (string) | Select the environment to use in tag-loading, defaults to “prod.” |
| 1: name (string), 2: value (string) | Add a property to the current tag-set; the property will be forwarded to the remote system. |
| 1: name (string), 2: value (any) | Add a property to the current tag-set; the property will be kept locally in the browser. |
| 1: | Add all object fields as properties to the current tag-set; the properties will be forwarded to the remote system. |
| 1: | Add all object fields as properties to the current tag-set; the properties will be kept locally in the browser. |
| N/A | Call the remote servers and load all configured tags. |
| N/A | Reset the page-structure and all previously configured properties. |
| 1: string | Set the default cookie domain for all Relay42 cookies (starting with |
| 1: string | Set the default cookie TTL (time to live) for all Relay42 cookies (starting with |
| N/A | Function to set a debug message for a tag that’s not executed due to a selection rule or journey rule |
| 1: | Functions to pass settings |
Additional functions (data tracking)
Function | Arguments | Description |
|---|---|---|
| 1: true/false (boolean) | When an engagement has been set (true), the engagement and all its additional data will be triggered by a 'trackPageView' or 'trackInPageEvent'. |
| 1: name (string) | The engagement type is defined in the 'configuration' tab |
| 1: content (any) | Add content to the current engagement. |
| 1: name (string), 2: value (any) | Add a property to the engagement. |
| - | - |
| - | - |
| 1: true (boolean) | When a conversion has been set (true), the conversion and all its additional data will be triggered by a 'trackPageView' or 'trackInPageEvent'. |
| 1: transactionId (string) | To identify unique conversions |
| 1: value (double) | Keep track of the value of conversions |
| 1: product identifier (string) | Keep track of number of products |
| 1: key identifier (string) | The key under which shared permission is saved to the server. This can be used while using cross-domain. Please refer to support for further information |
Examples
setEnvironment
Select the environment to use in tag-loading, defaults to “prod”.
_st('setEnvironment', 'test');setPageStructure
Identify the current page, components are used to form a tree structure.
_st('setPageStructure', 'default|structure');You can also use the following format:
st('setPageStructure', 'default', 'structure');setDefaultPageStructure
Identify the fallback structure for the current page, components are used to form a tree structure.
_st('setDefaultPageStructure', 'default|structure');setStructurePrefix
Set a prefix for the pagestructure which prepended to the configured structure.
_st('setStructurePrefix', 'special');addTagProperty
Add a property to the current tag-set, the property will be forwarded to the remote system.
_st('addTagProperty', 'example', 'property');addLocalTagProperty
Add a property to the current tag-set, the property will be kept locally in the browser.
_st('addTagProperty', 'exampleLocal', 'property');addTagProperties
Add all object fields as properties to the current tag-set; the properties will be forwarded to the remote system.
_st('addTagProperties', {'example': 'property', 'otherExample': property});addLocalTagProperties
Add all object fields as properties to the current tag-set; the properties will be kept locally in the browser.
_st('addLocalTagProperties', {'exampleLocal': 'property', 'otherLocalExample': property});resetTags
Reset the page-structure and all previously configured properties.
_st('resetTags');addLocalTagProperties
Add all object fields as properties to the current tag-set; the properties will be kept locally in the browser.
_st('addTagProperty', 'example', 'property');loadTags
Activate the loading of the tags based on the settings added at this moment.
_st('loadTags');loadTags (shorthand 1)
The same as the normal loadTags but with adding the page structure directly to the call.
_st('loadTags', 'homepage', 'product');loadTags (shorthand 2)
The same as the normal loadTags but with adding the page structure and a set of normal tagProperties directly to the call.
_st('loadTags', 'homepage|product|details', {country:'be', language:'nl'});