This reference covers the configuration commands available in the Supermetrics Data Activation base script. Use these commands to set environments, define page structures, attach properties to tags, and control when tags load.
For an introduction to the basescript and how to add it to your website, see About the basescript.
Environment
setEnvironment
Select the environment for tag loading. Defaults to prod.
_st('setEnvironment', 'test');Use test to load tags from the test environment during development. Switch to prod (or omit the command entirely) for production.
Page structure
setPageStructure
Identify the current page. Components form a tree structure that you use to organize tags.
_st('setPageStructure', 'category', 'subcategory');You can pass the structure as separate arguments or as a pipe-separated string:
_st('setPageStructure', 'category|subcategory');Both formats produce the same result.
setDefaultPageStructure
Set a fallback page structure. The basescript uses this structure when no setPageStructure command runs on a page.
_st('setDefaultPageStructure', 'default|structure');setStructurePrefix
Add a prefix that the basescript prepends to the page structure.
_st('setStructurePrefix', 'special');If you set the prefix to special and the page structure to category|subcategory, the resulting structure becomes special|category|subcategory.
Tag properties
addTagProperty
Add a single property to the current tag set. The property is forwarded to the remote system.
_st('addTagProperty', 'productId', '12345');addLocalTagProperty
Add a single property to the current tag set. The property stays in the browser and isn't forwarded to the remote system.
_st('addLocalTagProperty', 'sessionStart', 'true');addTagProperties
Add multiple properties to the current tag set at once. All properties are forwarded to the remote system.
_st('addTagProperties', {
productId: '12345',
category: 'electronics'
});addLocalTagProperties
Add multiple properties to the current tag set at once. All properties stay in the browser.
_st('addLocalTagProperties', {
viewCount: '3',
referrer: 'homepage'
});Resetting and loading
resetTags
Reset the page structure and all previously configured properties. Use this before setting up a new page view — for example, in single-page applications when the user navigates without a full page reload.
_st('resetTags');loadTags
Activate tag loading based on the settings you've configured. Call this after you've set the environment, page structure, and properties.
Standard call:
_st('loadTags');With page structure (shorthand):
_st('loadTags', 'homepage', 'product');This is equivalent to calling setPageStructure followed by loadTags.
With page structure and properties (shorthand):
_st('loadTags', 'homepage|product|details', { country: 'be', language: 'nl' });This sets the page structure and adds tag properties in a single call.
Common patterns
Standard page view
A typical page with a defined structure and tag properties:
_st('setPageStructure', 'products', 'detail');
_st('addTagProperties', {
productId: '12345',
price: '49.99',
currency: 'EUR'
});
_st('loadTags');Single-page application navigation
When the user navigates in a single-page application, reset and reconfigure before loading tags:
_st('resetTags');
_st('setPageStructure', 'checkout', 'confirmation');
_st('addTagProperty', 'orderId', '98765');
_st('loadTags');Using the loadTags shorthand
For simple pages where you only need a page structure and a few properties:
_st('loadTags', 'homepage', { campaign: 'spring-sale' });