Skip to main content
Version: 4.2

Container Variables

Understanding Container Variables

In Google Tag Manager, variables serve as placeholders for values that are filled in when code executes on your website or mobile app. For instance, the "Page URL" variable in Tag Manager provides the current web page URL. These variables are essential components used in triggers and tags.

This guide provides comprehensive instructions for creating User-Defined Variables in Google Tag Manager to link information from WHMCS to your container via Data Layer. These user-defined variables will be populated with data from WHMCS and can be readily utilized in triggers and tags throughout your setup.

using variables

In Container Tags section we will provide an essential yet comprehensive set of tags that will use these variables. But you are free to use them in any other tag that your marketing strategy requires.

How to Create Variables

To create a new Data Layer variable in your container for using with GA4 property go to Variables -> New.

Click on the dialog box Variable Configuration to open the choice options and on the right panel select the variable type Data Layer Variable.

All variables needed for the module Google Tag Manager for WHMCS are split in sections to better understanding. Below is a list of the variables that you need to create in your Google Tag Manager container.

upgrade from v4.1

If you are upgrading from version 4.1 or older, some variables are deprecated and will not be available on Data Layer in future updates. These variables will be indicated on they description. We recommend you to migrate to the new equivalent variables as soon as possible.

Google Tag & Measurement ID Variables

To simplify the configuration and minimize tag duplication, you can create a variable to store the Google Tag ID and Measurement ID. This variable will be used in all tags that require these IDs.

Google Tag ID

  • name: Google Tag ID
  • Variable Type: Constant
  • Value: YOUR-GOOGLE-TAG

Google Measurement ID

  • name: Google Measurement ID
  • Variable Type: Constant
  • Value: YOUR-GOOGLE-MEASUREMENT

WHMCS Variables

Below is a list of the variables that you be used to identify some information about your WHMCS that will be available to use in any triggers and tags.

NameData Layer Variable NameDescription
WHMCS - Currencycurrencyresponsible to bind the actual WHMCS selected currency code of shopping cart. (deprecated)
WHMCS - CurrencywhmcsData.currencyresponsible to bind the actual WHMCS selected currency code of shopping cart. (added in v4.2)
WHMCS - Languagelanguagecurrent WHMCS user language (ex.: wn). (deprecated)
WHMCS - LanguagewhmcsData.languageCurrent selected WHMCS language on user session (ex.: en).
WHMCS - Localelocalecountry locale code based on the session language. (deprecated)
WHMCS - LocalewhmcsData.localecountry locale code based on the session language.
WHMCS - Templatetemplatethe template name used on user session (ex.: six). (deprecated)
WHMCS - TemplatewhmcsData.templatethe template name used on user session (ex.: six).
WHMCS - Order FormwhmcsData.order_formthe order form name used on user session (ex.: standard_cart).

User Variables

User variables are used to identify the user type and some information about the user that will be available to use in any triggers and tags.

The table below shows the user variables that you need to create in your Google Tag Manager container.

NameData Layer Variable NameDescription
UserTypeuserTypeused to identify the user type: visitor when user is not identified and client when logged in. (deprecated)
User Data - TypeuserData.user_typeused to identify the user type: visitor when user is not identified and client when logged in.
User Data - Loggedinloggedinboolean value that identify if user is logged in, true when logged in and false when not. (deprecated)
User Data - Logged InuserData.logged_inboolean value that identify if user is logged in, true when logged in and false when not.
User Data - LanguageuserData.languageCurrent language code used on user session .
User Data - UUIDuserData.user_uuidWHMCS Client UUID.
User Data - CurrencyuserData.currencyUser currency code.
User-ID collection

To enable User-ID collection in Google Analytics 4 please refer to the User-ID collection documentation.

Customer Variables

Customer variables are used to identify the customer type and some information about the customer that will be available to use in any triggers and tags.

The table below shows the customer variables that you need to create in your Google Tag Manager container.

NameData Layer Variable NameDescription
Customer Data - UUIDcustomerData.customer_uuidWHMCS Client UUID.
Customer Data - StatuscustomerData.customer_statusWHMCS Client Status (Active/Inactive).
Customer Data - EmailcustomerData.emailWHMCS Client Email.
Customer Data - Email (hash)customerData.email_hashSHA256 WHMCS Client Email hash.
Customer Data - First NamecustomerData.first_nameWHMCS Client First Name.
Customer Data - First Name (hash)customerData.first_name_hashSHA256 WHMCS Client First Name hash.
Customer Data - Last NamecustomerData.last_nameWHMCS Client Last Name.
Customer Data - Last Name (hash)customerData.last_name_hashSHA256 WHMCS Client Last Name hash.
Customer Data - PhonecustomerData.phoneWHMCS Client Phone.
Customer Data - Phone (hash)customerData.phone_hashSHA256 WHMCS Client Phone hash.
Customer Data - CompanycustomerData.company_nameWHMCS Client Company.
Customer Data - StreetcustomerData.address.streetWHMCS Client Street.
Customer Data - CitycustomerData.address.cityWHMCS Client City.
Customer Data - RegioncustomerData.address.regionWHMCS Client Region/State.
Customer Data - CountrycustomerData.address.countryWHMCS Client Country.
Customer Data - PostalCodecustomerData.address.postal_codeWHMCS Client Postal Code.
tip

To see how to use customer data to enhance your Google Ads campaigns, please refer to the Google Ads documentation.

Ecommerce Variables

Ecommerce variables are used to identify the ecommerce type and some information about the ecommerce that will be available to use in any triggers and tags.

The table below shows the ecommerce variables that you need to create in your Google Tag Manager container.

NameData Layer Variable NameDescription
Ecommerce DataecommerceCollection of ecommerce data.
Ecommerce Data - Itemsecommerce.itemsCollection of products/services.
Ecommerce Data - Valueecommerce.valueMonetary transaction value.
Ecommerce Data - Taxecommerce.taxTax value on orders.
Ecommerce Data - Affiliationecommerce.affiliationAffiliation or referral.
Ecommerce Data - Couponecommerce.couponCoupon code used in a order.
Ecommerce Data - Transaction IDecommerce.transaction_idWHMCS Order ID.
ecommerce itens

You can create additional variables as your request to store specific information about your products and services. For example, you can create a variable to store the product category or the product PID that is available inside the Ecommerce Data - Itens.

Event Settings Variable

Google Tag: Event Settings variable is a reusable variable that contains settings for Google tags and GA4 Event tags. For WHMCS, this variable is used to store some user data that are available across multiple events.

To creat e a new Google Tag Event Settings variable go to Variables -> New.

Click on the dialog box Variable Configuration to open the choice options and on the right panel select the variable type Google Tag: Event Settings. Under the Google Analytics User Properties tab, add the follow properties:

Property NameValue
language{{User - Language}}
logged_in{{User - Logged In}}
user_type{{User - Type}}
template{{WHMCS - Template}}

note

For more information about Google Tag Event Settings please visit Google official documentation https://support.google.com/tagmanager/answer/13438771?hl=en

User-Provided Variable

User-Provided Data is a variable that stores the user data that is provided by the Data Layer on your WHMCS. Having this variable is required when you enable Enhanced Conversions for Web feature.

To create a new User-Provided Data variable go to Variables -> New, click on the dialog box Variable Configuration to open the choice options and on the right panel select the variable type User-Provided Data.

On Type option, select Manual Configuration, under each field select the respective variables from the Customer Data group.

Field NameValue
Email{{Customer Data - Email (hash)}}
Phone{{Customer Data - Phone (hash)}}

Under Name and Address tab, set the respective variables from the Customer Data group.

Field NameValue
First Name{{Customer Data - First Name (hash)}}
Last Name{{Customer Data - Last Name (hash)}}
Street{{Customer Data - Street}}
City{{Customer Data - City}}
Region{{Customer Data - Region}}
Country{{Customer Data - Country}}
Postal Code{{Customer Data - PostalCode}}

info

Google Services expect PIIs to be hashed before sending them to Google. The module will provide on Data Layer hashed and non-hashed values, ensure that you are using the correct one.

official documentation

To know more about User-Provided Data, visit About enhanced conversions and Set up enhanced conversions for web using Google Tag Manager documentations.

User-ID Attribution Variable

User-ID Attribution is a variable that stores the user ID that is provided by the Data Layer on your WHMCS. Having this variable will allow you to record the defined User-ID Attribution.

  • Name: User-ID Attribution
  • Variable Type: Data Layer Variable
  • Data Layer Variable Name: user_id

official documentation

To learn more about User-ID attribution visit Measure activity across platforms with User-ID documentation.