Commanders Act X
Platform XDocumentationWelcome to Success
  • Welcome !
  • Platform updates
    • Announcements
    • Documentation updates
    • Release notes
  • Getting started
    • How the platform works
      • Glossary
        • Condensed platform concepts
    • Platform interface
      • Prod and Testing environments
      • Productivity tools
        • Commander's AI
    • Integrating your data
      • GTM Tutorial
      • OneTag Tutorial
      • Migration guides to the Platform X
        • Migrate from SSv1 to SSv2
          • Send data to serverside v2
            • Purchase event example (ssv1 to ssv2)
        • Migrate from old mobile sdk
  • Features
    • Sources
      • Sources Overview
      • Sources Catalog
        • Web
          • Web container
            • User guides for browser-side platform
              • Container
                • Hosting
                • Creation and modification
                • Generation
                • Testing
                • Deployment and roll back
                • Deletion
                • Statistics
                • Modification history
                • Javascript block
                • Branches
                • Plugin Commanders Act Assistant
              • Tags
                • Add tags
                • Configure tags
                • Rules
                  • Basic actions
                  • Triggers
                  • Perimeters & constraints
              • Data layer and data types
                • External variables
                • Internal variables
                • Event variables
                • Data storage
              • Deduplication
                • Setup guide
                • Setup example
                • Deduplication reports
              • TagPerformance
                • Setup guide
                • Report analysis
                • Troubleshooting
            • Setup guides for developers
              • Web container setup
              • Datalayer setup
              • Browser-side events setup
              • AMP
              • Angular
              • AngularJS
              • React
              • SPA implementation guide
              • VueJS
              • IOT & TV Apps
            • Best Practices
              • FAQ
              • Common Container Strategies
              • Common Trigger Strategies
              • Performance Optimization
              • tC.* attributes and methods
              • APIs
                • Onsite API
              • TMS & Consent banners IDs
          • Javascript SDK
            • Next.js serverside rendering
          • Pixel Tracking API
          • Google Tag Manager (GTM)
          • Shopify
        • Mobile APP
          • Android
          • iOS
          • Flutter
          • React native
        • Advertising
          • Bing Ads (cost import)
          • Facebook Ads (cost import)
          • Criteo (cost import)
          • Realytics
        • Import CRM users
          • API users
          • Users file importer
        • Import conversions
          • API Conversions and Product catalog
          • Conversions files importer
        • Product catalog
          • Product catalog files importer (FTP)
        • Server
          • HTTP tracking API source
            • (deprecated) HTTP tracking API source 1.0
          • Node.JS
          • Python
          • PHP
      • Source Live Event Inspector
      • Source data quality
    • Destinations
      • Destinations overview
        • Automatic Audience replay
      • Destinations catalog
        • AbTasty
        • Actito
        • Adform
        • Adobe
          • Adobe Analytics
          • Adobe Campaign
        • AdRoll
        • Adition
        • Adventori
        • Affilae
        • Alphalyr Marketing Studio
        • Amazon
          • Amazon Ads Conversions API
          • Amazon S3
        • Attraqt
        • Awin
        • Batch Audience
        • Branch Events
        • Button
        • Campaign Analysis Legacy
        • Commission Junction
        • Criteo
          • Criteo - Events
          • Criteo (audiences)
          • Criteo (offline conversions)
        • Data Activation Legacy
        • Dataventure
        • Destination Logs Exporter (closed beta)
        • Dialog-Mail
        • Dynamic Yield
        • Easyence
        • Effinity
        • Eloqua
        • Emarsys
        • Email export
        • Equativ Audience
        • Experian
        • Facebook
          • Facebook Conversions API
            • Facebook CAPI through GTM
            • Performance tab (Event Match Quality)
          • Facebook Custom Audiences
          • Facebook Lead Ads
        • FTP
        • Gamned
        • Google
          • Google Analytics 4
            • Google Analytics 4 - Proxy Mode
          • Google BigQuery
          • Google Conversion Adjustments
          • Google Customer Match
          • Google Display & Video 360 & Search Ads 360
          • Google Enhanced Conversions
          • Google Enhanced Conversions for Leads
          • Google Floodlight Mobile App Conversion
          • Google Search Ads 360 Enhanced Conversions
          • Google Store Sales Direct
        • IBM
        • Inxmail
        • IntelliAd
        • Jellyfish
        • Kameleoon
          • Kameleoon Audience
          • Kameleoon Events
        • Kelkoo
        • Kwanko
        • LinkedIn Conversions API
        • Liveramp
        • Magento
        • Marin Software
        • Mapp
        • Matomo
        • MediaMath
        • Microsoft Advertising Universal Event Tracking
        • Mindlytix
        • Moebel
        • Nextdoor Conversion API
        • OXID
        • Optimizely
        • Outbrain
        • Partnerize
        • Piano Analytics
          • Piano Analytics Collection API
          • Piano Analytics Enrichment API
        • Pinterest
        • Piwik PRO
        • Prediggo
        • Qlik
        • Quantcast
        • Quora Ads Conversion API
        • Rakuten
          • Rakuten Audience
          • Rakuten Events
        • Realytics
        • Reddit Conversions API
        • Responsys
        • RhythmOne
        • Rich Relevance
        • RTB House Audience
        • Salesforce
          • Salesforce Audience Studio
          • Salesforce Marketing Cloud
          • Salesforce Commerce Cloud
        • SAP Commerce Cloud
        • Selligent
        • Skai
        • Smart Adserver
        • SmartFocus
        • Snapchat Conversions API
        • Splio
        • Syte
        • Tableau Online
        • Taboola
          • Taboola Audience
          • Taboola Events
        • Target2sell
        • Temelio
        • Teradata
        • The Trade Desk
          • The Trade Desk Conversions API
          • The Trade Desk Audience
        • TikTok
          • TikTok Events API
          • TikTok Offline Events
        • TimeOne
        • Tradedoubler
        • TradeTracker
        • X (Twitter) Conversion API
        • Xandr
        • Webhook
        • Webtrends
        • ZBO Media
        • Zeta
      • Destination builder
        • Javascript destination builder
          • Tutorial - How to build a server destination with the JS sandbox
          • Serverside javascript helpers
      • Destination filters
      • Mapping and Properties transformation
      • Event delivery
      • Destination event inspector
      • Dry mode (lab)
    • Enrichments
      • Augmented User Attributes
        • Business case
      • Events enrichment
      • Storage Settings
    • Data Quality
      • Event Specification
      • Sources data quality
      • Data cleansing
        • Supported transformation functions - Data cleansing
          • Format a date
    • Identity resolution
      • Migrate from Fuse v1 to Fuse v2
    • Customers
      • Segment
        • Segment overlap
        • Segment stats
    • Explore
      • Campaign analysis
        • Attribution
        • Control Group (Closed Beta )
      • User analysis
        • Dashboards
      • Consent Analysis
    • Consent management
      • Responsability of actors
      • Setup Guides
        • Tag Manager
          • Commanders Act TMS
          • Google Tag Manager (GTM)
          • Google Tag Manager (GTM) - Consent Mode
          • Google Consent Mode in Commanders Act CMP
          • Adobe Launch
        • Websites (Hardcoded)
        • FR : Suppression des cookies lors du retrait du consentement
        • Mobile apps
          • iOS
            • ATT - App Tracking Transparency (iOS 14.5+)
          • Android
      • User Guides
        • Categories & Tags
          • Manage Categories
          • Manage Vendors
          • Assign Categories
        • Privacy Banners
          • Banner Templates
            • Accessibility Template
          • Manage Banner
          • Deploy Banner
          • Copy Banner
        • Consent Analysis
        • Exports
        • Settings
      • Extensions
        • Cookie Scanner
        • Piggybacking
        • Tag Firewall
      • Marketing Preferences Center (additional module)
      • Knowledge Base
        • Consent Object
        • Consent cookies exemption
          • Implementation guide for exempted consent statistics FR market
        • Consent Cookie
        • IAB TCF V2.2 Release details
          • IAB TCF v2.2 CMP requirements
          • IAB TCF v2.2 Migration guide Web
          • IAB TCF v2.2 Migration guide App
        • IAB TCF V2.2 Consent
        • IAB TCF V2.2 and Google FAQ
        • Google ACM requires IAB TCF
        • CCPA & Global Privacy control
      • Rest Data API
        • GET/PUT Consents / preferences
      • OnSite API
        • Getting Started
        • consent.get
        • consent.update
        • consent.revoke
        • consent.onUpdate
        • consent.onReady
        • consentBanner.show
        • consentBanner.hide
        • consentCenter.show
        • consentCenter.hide
      • Platform API
        • Get statistics
  • Use cases
    • Data activation
      • Engage new customers
        • Welcome banner for new customers
        • Real-time promotion for hesitant customers
        • Discount banner for installing the application
        • Personalized ads
        • Engage similar audience (lookalike)
      • Increase loyalty
        • Drive to favourite store
        • Increase Customer Lifetime Value with a loyalty program
        • Notification about order delay
      • Increase revenue
        • Abandoned cart
        • Products recommendations
        • Complementary product offer
      • Retain customers
        • Identify a churn risk with RFM segmentation
        • Identify customers’ preferred channel
        • Contact with the customer support
      • Advocacy
        • Incentive to share customers' experience and rating
        • Sponsorship Program
        • Social Media Hashtag
    • Website performance
    • Consent banners A/B testing
    • Customer analysis
    • Campaigns performance analysis
  • Developers
    • Tracking & Integrations
      • Tracking
        • About events
          • E-commerce/retail events
          • Web event specificity
          • Mobile App event specificity
        • Events reference
          • Common events
          • E-commerce events
          • Video events
          • Campaign Tracking events
        • Properties reference
          • Global properties
          • Video properties
          • Permanent properties
        • Data API
          • HTTP API
          • Segment API
          • User API
          • Product catalog and conversion API
      • Server IP Whitelisting
    • Config API
    • Changelogs
      • Measure.js changelog
      • Web container generator
    • Content Security Policy
  • CONFIGURE
    • Data Management
      • Events collection
      • Data retention duration
      • Data Governance
    • Administration
      • User management
      • Domain Management
        • WAF Proxy (CloudFlare,...)
        • A record
        • CNAME record
        • On-Premise Proxy
        • Cookie CAID
        • First party hosting
      • Single Sign-On
      • Two-factor authentication (2FA)
      • Copy Management
    • Cookies
      • Cookie 1st
      • Cookie sync partners
      • First domain tracking (Phoenix)
    • Disclaimer
Powered by GitBook
On this page
  • Adding external variables
  • Categorizing external variables
  • Managing variable types
  • Editing and deleting external variables

Was this helpful?

Edit on GitHub
Export as PDF
  1. Features
  2. Sources
  3. Sources Catalog
  4. Web
  5. Web container
  6. User guides for browser-side platform
  7. Data layer and data types

External variables

These variables are called external variables because they are outside the Commanders Act web container: They are embedded directly in the source code of your site’s pages, in contrast with internal variables, which are created inside the container and therefore not visible in the page’s source code. External variables are added by your technical teams or the technical provider in charge of implementing Commanders Act web containers on your site.

External variables are indispensable since they contain most of the data sent to the solutions present in the container. Their function and number vary depending on the site’s economic model (for example, media sites will not have the same external variables as e-commerce sites).

The list of external variables must be considered and established before Commanders Act web container is implemented in order to meet the embedded solutions’ medium- to long-term needs. A summary of the external variables to implement on your site will be provided by your Commanders Act consultant during the setup phase of the TMS, in an Excel file named “deliverables” or “tagging plan“.

External variables must be declared in the Commanders Act interface before you begin configuring tags in your containers. See the “Adding external variables” article in this section to find out how to declare an external variable in the interface.

All declared external variables can be used:

– To pass information to the solutions embedded in the container (linking external variables and solutions is called mapping). See the “Mapping Tags’ Variables” article to find out how to map your external variables in a tag.

– To create activation rules for your tags. See the “Adding Rules” section to find out how to create rules based on your external variables.

Additional information

As with your container, external variables must be present on all of your site’s pages and assigned values suited to the context. For example:

– The value of the “page template” variable will be different for the most important page templates on your site: homepage, product page, confirmation page, etc.

– The value of the “user id” variable will change for each visitor that connects to your site.

External variables must be declared in your site’s source code before the call to your containers (=JavaScript files). If you have a header container, the external variables will thus be present in the <head>; if you have a container in the body, they must be declared in the <body> html tag.

Here is a sample list of external variables:

<script type="text/javascript">
var tc_vars = new Array();
tc_vars["env_work"] = 'Prod';
tc_vars["env_channel"] = 'Web';
tc_vars["env_language"] = 'fr';
tc_vars["env_country"] = 'FR';
tc_vars['page_type'] = 'Homepage';
tc_vars["page_name"] = 'Tag Commander Market';
tc_vars["page_category_1"] = '';
tc_vars["page_category_2"] = '';
tc_vars["page_category_3"] = '';
</script>

/* Data layer is setup - call the Web Container Script underneath */

<script type="text/javascript" src="//cdn.tagcommander.com/674/my_web_container.js"></script>

Adding external variables

There are two situations in which you may need to declare your variables in the external variable management interface:

1) You wish to install Commanders Act on a new site: prior to having your technical teams or technical provider implement the data layer/variables in your site’s source code, you need to declare the variables in the Commanders Act interface so they are available for mapping.

2) Information is missing from your current tagging plan (e.g. customer status): Again, this variable must be declared in the interface first, before it can be used in your tags and rules.

Clicking “Download” will open a window containing the JavaScript code to insert in the site’s source code:

To add an external variable, you must go to the “Data Management” > "Web Data layer" > “External Variables” and click “ADD VARIABLE”

“Name“: the variable’s name (mandatory field).

“Category“: used to categorize the variable according to its application (e.g. variable relative to users, product pages, confirmation pages, etc.) See the “Categorizing External Variables” article in this section.

“Type“: The type of variable. See the “Managing Variable Types” article in this section.

“Use in noscript“: Check the box so that the variable is present in the tag’s noscript code.

“Description“: A description of the variable, to clarify the variable’s name (e.g. “Page template” can be the description of the variable named “env_template”).

“Detailed description“: A detailed description of the variable, to further clarify the variable’s name (e.g. “possible values: homepage/category/product/funnel_confirmation” can be the detailed description of the “env_template” variable).

Once the variable is added, it will appear on the variables list:

Categorizing external variables

Variables can be categorized for easier management.

Categories allow you to classify variables according to their application (e.g. variables relative to site users in the “Users” category, variables for product pages in the “Product page” category, generic cross-functional variables for the site in the “Environment” category, etc.)

Categories are managed by clicking the “manage categories” button to the left of the “ADD VARIABLE” button:

Managing variable types

The variable “type” (also called “processing function“) allows you to modify the variable format on the fly when mapping your tags.

They are useful when one of your solutions requires a variable format that is different from the format used in the external variables by the technical teams in charge of implementing the data layer.

For example, if your “page_name” variable contains special characters in the source code, the processing functions allow you to correct them so that your solutions can receive the value without special characters.

The most commonly used types are:

  • Order amount: this allows you to modify the number format (amount) on the fly.

You can change separating commas into periods (e.g. “12,50” becomes “12.50”), choose the number of decimal places to retain (e.g. “12.50 becomes “12.5”), or convert the amount into pennies (“12.50 becomes “1250”).

  • Alphanumeric & Special chars: this allows you to modify the character string format on the fly.

You can replace special characters with “_” (e.g. “the company&its values” changes to “the company_its values”) or truncate a character string (e.g. limiting the variable’s value to 10 characters).

Once you have mapped your variable, click the link symbol:

Advanced : 2-dimensional array

This type can be assigned to variables having a two-dimensional array as a value. On an ecommerce site, this will deal very often with “list_product” and “order_product” variables that return, respectively, information on products displayed on a category page or added to the cart.

We speak of “two-dimensional arrays” since these variables return an array of values for each product (e.g. for all the products on the site’s page, their ID, name, price, quantity, etc.).

Certain partner solutions may request that you send product data in their tag that are separated by a character called a “separator” (e.g. all product IDs separated by “|“, or all product prices separated by a comma in their confirmation tag).

The operation will be much easier if you select the “Two-dimensional array” processing function for your “order_product” variable.

You will then be able to send your partners the information they expect without requiring any knowledge of JavaScript.

The first step in the configuration process is to select the “Two-dimensional array” type (1) for your variable:

Once this type is added, click on the “List” icon that appears next to your variable to see a summary of the external variables:

Enter all your array keys in the window that appears (e.g. if your main variable is “list_products”, the keys will be characteristics of your products, i.e. the ID, name, price, etc.):

After selecting the “Two-dimensional array” type for your variable go to the “EDIT” step. Click the symbol appearing to the left of the variable that you just mapped:

Enter the array key in the configuration window (e.g. the product ID) and the separator:

Editing and deleting external variables

You can edit an external variable by clicking the “Edit” icon and delete it by clicking the trash can. The flag next to the variable’s name will tell you if it is mapped and the tag(s) it is mapped with:

Note: The variables used in a container (to be added to a tag, for example) cannot be deleted, and their names cannot be modified.

By clicking on the flag, you will see which container(s), tag(s) or rule(s) use this variable:

PreviousData layer and data typesNextInternal variables

Last updated 1 year ago

Was this helpful?

Note: If necessary, you can click “Download“, to retrieve your external variables in JavaScript format and send them to your technical team or the technical provider in charge of implementing the variables in you site’s source code:

The “add variable” window contains various fields:

Once your category is created, it can be used in the window to add and edit external variables; you can edit them by clicking the pencil icon, delete them by clicking the cross and adding them by entering a name and clicking the blue "+" button :

After assigning a variable type, you can modify its value on the fly, tag by tag, in the “EDIT” interface. Variables with a type added will have a blue symbol in front of their name (1):

A window will appear with a list of different operations corresponding to the type chosen. Check the box corresponding to the operation you want (for example, remove special characters and replace them by “_”) and click “SAVE” :

You can also use the “Two-dimensional array” type to create internal variables that return product keys separated by the symbol of your choice. For more information, go to the “Adding Custom Internal Variables – Builder Mode” article.