---
title: "Base script configuration reference"
slug: "base-script-configuration-reference"
description: "Configure Supermetrics Data Activation commands to manage environments, page structures, and tag properties for efficient tag loading on your website."
updated: 2026-06-02T11:16:37Z
published: 2026-06-02T11:16:37Z
---

> ## 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.

# Base script configuration reference

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.

```javascript
_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.

```javascript
_st('setPageStructure', 'category', 'subcategory');
```

You can pass the structure as separate arguments or as a pipe-separated string:

```javascript
_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.

```javascript
_st('setDefaultPageStructure', 'default|structure');
```

### setStructurePrefix

Add a prefix that the basescript prepends to the page structure.

```javascript
_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.

```javascript
_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.

```javascript
_st('addLocalTagProperty', 'sessionStart', 'true');
```

### addTagProperties

Add multiple properties to the current tag set at once. All properties are forwarded to the remote system.

```javascript
_st('addTagProperties', {
  productId: '12345',
  category: 'electronics'
});
```

### addLocalTagProperties

Add multiple properties to the current tag set at once. All properties stay in the browser.

```javascript
_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.

```javascript
_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:**

```javascript
_st('loadTags');
```

**With page structure (shorthand):**

```javascript
_st('loadTags', 'homepage', 'product');
```

This is equivalent to calling setPageStructure followed by `loadTags`.

**With page structure and properties (shorthand):**

```javascript
_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:

```javascript
_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:

```javascript
_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:

```javascript
_st('loadTags', 'homepage', { campaign: 'spring-sale' });
```

## More resources

- [How to set up web tracking and event collection](/v1/docs/how-to-set-up-web-tracking-and-event-collection)
