What are custom variables (CVARs)?
CVARs are key-value pairs pulled from your website's data layer that provide additional information about each page, so you can categorize a page. Examples include:
- Page type (homepage, product page, list page, checkout)
- Page category (men's clothing, electronics, support articles)
- Checkout step (cart, shipping, payment, confirmation)
- Product attributes (brand, season, collection)
- User context (logged in/out, user type, region)
If your website includes a datalayer, you can define your mapping with cvars, otherwise, you'll have to use pages. The Contentsquare Tracking Setup Assistant can help you identify captured cvars that can be used to create your mapping.
How to create a mapping based on CVARs
The Mapping Assistant streamlines the mapping creation process by automatically grouping pages together, reducing setup time. This helps you access analysis and insights faster.
Custom Variables (CVARs) allow you to collect 'additional information' from the datalayer of your website, this information can then be used to create mappings. The Mapping Assistant will automatically populate custom variable values with additional information on the page type (Product page, List page, checkout, etc.) and match the right pages.
-
Click 'New mapping'.
-
Click 'Mapping Assistant'.
-
Open the 'I want to split with' drop menu and click 'Custom variable'.
-
Select values for your new page groups (one value=one page group).
Tip: Review the page count for each value. The assistant shows how many pages match each CVAR value to help you validate that your selections make sense.
- Rename each page group with descriptive names E.g. page_type=product, name it 'Product Pages'.
- Assign a category to each page group.
- Click 'Create mapping'.
- After creating a CVAR-based mapping:
- Check the page count for each page group—does it match expectations?
- Review the "Undefined" pages—are important pages missing?
- Click into a few page groups and review the pages list—are the right pages included?
Note: Mappings with CVARs are not necessarily exhaustive. Once the pages are created, you can refine the mapping and use all functionalities (move, exclude, etc.).
How to refine a page group using CVARs
Refine a page group using CVARs if you have a page group that's too broad and want to narrow it down.
- Go to 'Mappings' and select the mapping you need to refine using CVARs.
- Click on the page group you want to refine.
- Select 'Refine' from the actions menu.
- Add a new CVAR condition.
- Click 'Save'.
Example: Your "Product Pages" group contains all products, but you want to focus only on products from a specific brand:
- Custom Variable: product_brand
- Operator: Exactly matches
- Value: Enter in the brand name
Your page group shows only products of the brand name. Pages that don't match the brand condition are moved to 'Undefined'.
How to split a page group using CVARs
Split a page group using CVARs if you have one broad page group and want to split it into multiple specific groups.
Example: Your "Product Pages" group contains all products, and you want to split it by category (Electronics, Clothing, Furniture).
- Go to your mapping.
- Click on the page group you want to split (e.g. "Product Pages").
-
Select 'Split' from the actions menu.
-
Choose 'Split with custom variable'.
-
Select your custom variable from the drop down list.
-
Select which values to split by, then click 'Next'.
For example: Electronics, Clothing, Furniture. - Rename the new page groups if needed, then click 'Next'.
- Click 'Save'.