How do you set up custom dimensions in Google Tag Manager? A Step by Step Guide
ustom dimensions in Google Analytics allow you to collect and analyze additional data that’s not automatically tracked. To set up custom dimensions using Google Tag Manager (GTM), follow these steps:
- Log in to Google Analytics: Sign in to your Google Analytics account at https://analytics.google.com/ and select the property for which you want to create custom dimensions.
- Create a custom dimension in Google Analytics:
a. For Universal Analytics: Click on “Admin” (the gear icon) in the lower-left corner. Under the “Property” column, click “Custom Definitions” and then “Custom Dimensions.” Click “New Custom Dimension” and enter a name for your custom dimension, choose the scope, and click “Create.”
b. For GA4: Click on “Admin” (the gear icon) in the lower-left corner. Under the “Property” column, click “Custom Definitions” and then “Custom Dimensions.” Click “Create Custom Dimensions” and enter a name for your custom dimension, and click “Save.”
Note the index number (for Universal Analytics) or parameter name (for GA4) assigned to your custom dimension.
- Log in to Google Tag Manager: Sign in to your GTM account at https://tagmanager.google.com/ and select the container associated with your website.
- Create a new variable: Click “Variables” in the left-hand menu, then click the “New” button in the “User-Defined Variables” section. Give your variable a descriptive name that reflects the custom dimension you’re creating, such as “Logged-in Status” or “User Type.”
- Choose a variable type: Click on “Variable Configuration” and select the appropriate variable type based on the data you want to capture for your custom dimension. Common variable types include “Data Layer Variable,” “URL Variable,” “Auto-Event Variable,” or “First-Party Cookie.”
- Configure the variable: Based on the variable type you’ve chosen, enter the required configuration settings. For example, if you’re using a Data Layer Variable, specify the variable’s Data Layer key.
- Save your variable: Click “Save” to finish creating your variable.
- Modify your Google Analytics tag: Navigate to the “Tags” section and click on the existing Google Analytics tag you want to send the custom dimension data to.
- Configure the tag:
a. For Universal Analytics: In the “Tag Configuration” section, click “Enable overriding settings in this tag” (if not already enabled), and expand the “More Settings” dropdown. Click “Custom Dimensions” and enter the index number from step 2. For “Dimension Value,” enter your variable wrapped in double curly braces, like
{{Logged-in Status}}
.b. For GA4: In the “Tag Configuration” section, expand the “Fields to Set” dropdown. Click “Add Row” and enter the parameter name from step 2 under “Field Name.” For “Value,” enter your variable wrapped in double curly braces, like
{{User Type}}
. - Save your tag: Click “Save” to finish updating your Google Analytics tag.
- Test your setup: Before publishing your changes, use the “Preview” mode in GTM to test your custom dimension tracking on your website. Ensure the variable is correctly capturing and sending data to Google Analytics.
- Publish your changes: If your custom dimension tracking works correctly in Preview mode, click “Submit” in the top right corner of the GTM interface to publish your changes and make your custom dimension tracking live on your website.
By following these steps, you can set up custom dimensions in Google Tag Manager and capture valuable data for analysis in Google Analytics. This allows you to gain deeper insights into user behavior and optimize your website and marketing efforts