# Common Data Layer Properties

Following you will find a collection of important Data Layer properties. These should be seen as a framework that can be adjusted to the needs of each individual site.

## Base Data Layer Properties

Base Data Layer Properties are recommended for all TagCommander implementations. They are the minimum amount of properties to allow a straightforward handling of common Tags.

| Property               | Description                                                                                            | Example                                               |
| ---------------------- | ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------- |
| env\_template          | Page type identifier—most important property that allow users to play out Tags only on relevant pages. | "homepage", "product\_detail", "funnel\_confirmation" |
| env\_work              | Environment identifier                                                                                 | "prod", "stage", "dev"                                |
| env\_country           | Site country code (ISO\_3166-1\_alpha-2)                                                               | "DE", "EN", "FR"                                      |
| env\_language          | Site language code (ISO 639-1)                                                                         | "DE", "EN", "FR"                                      |
| page\_name             | Name of the page.                                                                                      | "Our new phone!"                                      |
| page\_cat1\_name       | Page top category name                                                                                 | "smartphones"                                         |
| page\_cat2\_name       | Page category name                                                                                     | "apple"                                               |
| page\_cat3\_name       | Page sub category name                                                                                 | "iphones"                                             |
| page\_cat1\_id         | Page top category id                                                                                   | "1234"                                                |
| page\_cat2\_id         | Page category id                                                                                       | "2345"                                                |
| page\_cat3\_id         | Page sub category id                                                                                   | "3456"                                                |
| page\_search\_keywords | Search keywords on search or product finder pages                                                      | "new iphone"                                          |
| page\_search\_filters  | Array of search filters on search or product finder pages                                              | \["price", "rating"]                                  |

## User Data Layer Properties

User ids and properties are important for advertising and personalisation services.

| Property          | Description       | Example                                         |
| ----------------- | ----------------- | ----------------------------------------------- |
| user\_id          | User ID           | "12345"                                         |
| user\_email\_hash | Hashed user email | "kGghdg62173fh1123ff667128g"                    |
| user\_newcustomer | New customer flag | true for new customer, false for known customer |

## Data Layer Properties for Ecommerce Sites

It is recommended to extend the base Data Layer properties with following variables for ecommerce sites. These enable users to successfully track product and order information:

| Property                     | Description                                                                                                                                                                                                                  | Example                                       |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| env\_currency                | Currency code (ISO code 4217)                                                                                                                                                                                                | "EUR"                                         |
| product\_array               | An array of product objects that holds products information of currently viewed products on a page—product list pages usually hold several products (e.g. top 5 products of the page), product detail pages only one product | Described in section Data Layer Product Array |
| basket\_id                   | Unique basket ID                                                                                                                                                                                                             | "B12345"                                      |
| basket\_products             | An array of product objects that holds product information of current products in the basket                                                                                                                                 | Described in section Data Layer Product Array |
| order\_id                    | Unique order ID                                                                                                                                                                                                              | "O12345"                                      |
| order\_amount                | Total value of the order, without tax and without shipping fee                                                                                                                                                               | 123.45                                        |
| order\_amount\_ati           | Total value of the order, all tax included and without shipping fee                                                                                                                                                          | 234.56                                        |
| order\_amount\_ati\_with\_sf | Total value of the order, all tax included and with shipping fee.                                                                                                                                                            | 345.67                                        |
| order\_discount              | Total discount of the order without tax                                                                                                                                                                                      | 12.34                                         |
| order\_discount\_ati         | Total discount of the order with tax                                                                                                                                                                                         | 23.45                                         |
| order\_discount\_code        | Order discount or voucher code                                                                                                                                                                                               | "AB16887CDV883"                               |
| order\_products              | An array of product objects that holds product information of all ordered products on the product confirmation page                                                                                                          | Described in section Data Layer Product Array |

### Product Arrays

TagCommander recommends to structure lists of products (product\_array, basket\_products and order\_products) via an array of JavaScript product objects:

```javascript
tc_vars.product_array = [
    {
        product_id: "1234",
        product_name: "my product",
        ( ... )
    },
    {
        product_id: "2345",
        product_name: "my other product",
        ( ... )
    },
    ( ... )
]
```

Following you will find a list of recommended properties of each product entry:

| Property                 | Description                      | Example                 |
| ------------------------ | -------------------------------- | ----------------------- |
| product\_id              | Product ID—usually internal ID   | "12345"                 |
| product\_id\_variation   | Product ID variation—usually SKU | "2345"                  |
| product\_name            | Product name                     | "My product"            |
| product\_name\_variation | Product name variation           | "My other product name" |
| product\_unitprice       | Product unit price without tax   | 12.34                   |
| product\_unitprice\_ati  | Product unit price with tax      | 23.45                   |
| product\_discount        | Discount amount without tax      | 1.23                    |
| product\_discount\_ati   | Discount amount with tax         | 2.34                    |
| product\_cat1\_name      | Product top category name        | "smartphones"           |
| product\_cat2\_name      | Product category name            | "apple"                 |
| product\_cat3\_name      | Product sub category name        | "iphone"                |
| product\_cat1\_id        | Product top category id          | "1234"                  |
| product\_cat2\_id        | Product category id              | "2345"                  |
| product\_cat3\_id        | Product sub category id          | "3456"                  |
| product\_qty             | Product quantity                 | 5                       |

## Data Layer Variables for Publishers

Coming soon ...


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://community.commandersact.com/tagcommander/tips-and-tricks/best-practices/common-datalayer-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
