How to create an Analytics Property variable

To help you save time and prevent errors when updating the property of your Analytics tag, we recommend creating a reusable Analytics property variable.

To set this up, in the left-hand navigation click “Variables.” You’ll notice a list of built-in variables followed by user-defined variables. To create a user-defined variable, click “New.”

At the top of the form, click the pencil icon next to “Untitled Variable.” We’ll name this variable "gaProperty”.

Since we want to be able to reference the same value for multiple tags, under “Choose Type,” select “Constant.”

In order to update the value of our Analytics property from a single variable, under “Configure Variable” we’ll add our Analytics Property ID. Now select “Create Variable.”

You can now use this variable throughout Google Tag Manager wherever you would normally be prompted to enter your Analytics Property ID.

To try this out, we can replace the Analytics Property ID in the “Page View“ tag with the Constant variable we just created. Click “Tags.” Then select the Analytics “Page View” tag that you created previously.

Click on the "Configure Tag" section. Find the field labeled "Tracking ID" and click the “Tracking ID” selector button. Then select {{gaProperty}}. Now we’ll save the tag configuration.

Preview your container by clicking “Publish.” Then click “Preview.” If we navigate to The Great Outdoors Travel Adventures site, we can see the Analytics tag successfully firing in the “Preview” pane.

It’s that easy to create a single variable that you can use to update values across your website.

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

Search
Clear search
Close search
Main menu
4515965082401667533
true
Search Help Center
true
true
true
true
true
69256
false
false