What is a Custom Variable in Google Analytics?
While Google Analytics is fantastic at collecting standard data like pageviews and user counts, this default data often only tells you part of the story. To get truly business-specific insights, you sometimes need to track information unique to your website, like author names on a blog, subscription tiers for a SaaS product, or product variants on an e-commerce site. This is where Google's custom tracking features come into play. This article will walk you through what custom variables were, what they've become in Google Analytics 4, and how to use them to unlock deeper insights about your business.
First Things First: "Custom Variables" are Now "Custom Dimensions" & "Custom Metrics"
One of the most important things to know is that the terminology has changed. The term "Custom Variables" belongs to Google's older tracking platform, Universal Analytics (UA). If you are using the current version, Google Analytics 4, these concepts are now called Custom Dimensions and Custom Metrics.
While the goal is the same - to collect data specific to your business - the implementation and capabilities are different. Think of GA4's approach as a more flexible and powerful evolution of UA’s original custom variables.
To understand how to use these, you first need to get the difference between a dimension and a metric:
- Dimension: A dimension is a descriptive attribute of your data. Think of it as a label or a category. For example, City, Device Category, and Page Title are all default dimensions in GA4. They answer the "what," "who," or "where" questions.
- Metric: A metric is a quantitative measurement - a number. It's the number that gets counted within your dimensions. For example, Users, Sessions, and Event Count are default metrics. They answer "how many" or "how much."
A Custom Dimension lets you create your own text-based categories, while a Custom Metric lets you create your own numerical measurements.
Why You Need Custom Dimensions to Understand Your Business
The standard dimensions in GA4 give you a good overview, but they can’t tell you why something is happening in the context of your specific business model. Do users on your "premium" plan engage more than those on the "free" plan? Does one author’s blog posts drive significantly more conversions than others? You can't answer these questions out of the box.
Custom Dimensions allow you to segment your audience and analyze their behavior based on factors that matter to you. Here are a few examples to bring the concept to life:
For Content Websites and Blogs:
- Author Name: Track which authors' posts generate the most traffic, engagement, or newsletter sign-ups.
- Post Category: See if your articles about "Productivity" outperform your posts on "Team Management."
- Word Count Bucket: Did your long-form articles (e.g., 2000+ words) lead to more time on page than your shorter ones (e.g., under 800 words)?
For E-commerce Stores:
- Product Size or Color: Send product variant information (size, color, material) with
add_to_cartorpurchaseevents to see which options are most popular. - Loyalty Program Tier: Tag users with their loyalty status ("Gold," "Silver," "Bronze") to see if top-tier members have higher average order values.
- Stock Status: Track views of products when they are "In Stock" versus "Out of Stock" to gauge demand.
For SaaS Businesses:
- Subscription Plan: Send the user's plan ("Free," "Pro," "Enterprise") as a user-level dimension to compare feature usage and churn risk across plans.
- Company Role: If you collect user role during sign-up ("Developer," "Manager," "Marketer"), you can analyze how different personas use your application.
- User Onboarding Status: Track whether a user is in their "Trial Period," "Fully Onboarded," or "Needs Attention" to tailor your marketing campaigns.
The Big Difference: Understanding "Scope"
One of the most fundamental concepts for using custom dimensions is "scope." Scope determines how broadly a particular value is applied - to a single action, an entire session, or an individual user across all their sessions. The way scope works changed between Universal Analytics and Google Analytics 4.
Scopes in Universal Analytics ("Custom Variables")
In the old days of UA, a Custom Variable had a clear, defined scope that you'd set in your code.
- Hit-Level Scope: The value was only applied to the specific hit (single action) with which it was sent. This was great for things like the name of an article on a single pageview or a specific video that was played.
- Session-Level Scope: The value was applied to all hits within a single visit. For instance, you could mark a session as started from a specific login status (e.g., "Logged In") and that label would apply to every pageview and event within that session.
- User-Level Scope: The value was applied to all of a user's hits in their current and all future sessions, right up until the value was changed or expired. This was perfect for persistent attributes like "Subscriber" or "Premium Member."
Scopes in Google Analytics 4 ("Custom Dimensions")
GA4 simplified this a bit, organizing functionality around an event-based model. It primarily uses two scopes for custom dimensions:
- Event Scope: This is a lot like the old "hit-level" scope. An event-scoped custom dimension only applies to the specific event it was collected with. If you send an
author_nameparameter with apage_viewevent, that author's name only applies to that specific page view. This is the most common and versatile scope in GA4. - User Scope: This works exactly like the "user-level" scope in UA. It's used for attributes that describe a user and shouldn't change often. A User Property, like
subscription_plan, will be applied to all events for that user from the moment it is set, including across future sessions.
GA4 also automatically creates "item-scoped" custom dimensions for e-commerce, but event and user scopes are the main two you'll configure yourself. Notably, the session-level scope from UA doesn't have a direct equivalent in GA4, though you can often replicate it with a clever combination of event parameters.
How to Set Up a Custom Dimension in Google Analytics 4
Ready to create your first custom dimension? The process involves two major steps: first, sending the data from your website, and second, registering it within the GA4 platform so it becomes available in your reports. The best way to do this is with Google Tag Manager (GTM).
Step 1: Send the Custom Data as an Event Parameter using GTM
The "data" for your new dimension has to come from somewhere. GTM is a tool that reads information from your website and sends it to platforms like Google Analytics. In this example, let's say we want to track the author of a blog post.
- Capture the value: First, you need a way to grab the author’s name from the page. This is usually done with a JavaScript Variable in GTM that extracts text from a specific CSS element on your blog post template.
- Configure your GA4 Event Tag: In your main GA4 Configuration Tag or a specific GA4 Event Tag (like one that fires on page views for blog articles), go to the "Event Parameters" section.
- Add a New Parameter:
And that's it on the GTM side. Now, whenever the GA4 tag fires, GTM will send a parameter called author_name along with its corresponding value to Google Analytics.
Step 2: Register the Parameter as a Custom Dimension in GA4
Just because you send the data to GA4 doesn’t mean it will appear in your reports. You have to tell GA4 that this parameter is special and should be elevated into a permanent dimension for analysis.
- Navigate to your GA4 account and click on Admin (the gear icon in the bottom left).
- In the Property column, go to Custom definitions.
- Click the blue "Create custom dimensions" button.
- Fill out the configuration fields:
- Click Save.
Now what? You wait. Don't be surprised if your data doesn't show up right away. It can take 24-48 hours for new custom dimensions to be fully processed and appear in standard GA4 reports.
Step 3: Finding Your Custom Dimension in Reports
Once data starts flowing in, you can find it across GA4. A simple way is to go to Reports > Engagement > Pages and screens. Click the small "+" icon next to the primary dimension ("Page path and screen class") to add a secondary dimension. Search for your newly created dimension ("Author Name") and select it. Now you can see pageviews, users, and engagement metrics broken down by author!
Common Mistakes to Avoid
- Mismatched Naming: The number one issue is when the event parameter name you register in GA4 (e.g.,
author_name) doesn’t exactly match the parameter name you send from GTM (e.g.,Author_Name). They are case-sensitive! - Choosing the Wrong Scope: Be thoughtful about whether something describes the user (User scope) or a single action (Event scope). Attaching a category name to the user would be incorrect, as they will likely view posts in multiple categories.
- Sending Personal Information (PII): Never send data that could be used to personally identify a user, such as their email address, full name (unless it's public information like a blog author), or phone number. This is a direct violation of Google's terms of service and can get your account suspended.
- Forgetting About GA4's Limits: In the free version of GA4, you can create up to 50 event-scoped custom dimensions and 25 user-scoped ones. While this is a lot more than Universal Analytics offered, it's still finite. Plan how you'll use them to avoid running out of slots on non-critical data points.
Final Thoughts
Moving beyond the default reports with Custom Dimensions is how you turn Google Analytics from a generic traffic monitor into a powerful business analysis tool. By tracking attributes that are uniquely meaningful to your operations - be it authors, product features, or customer types - you get access to deeper, more actionable insights that can guide your strategy. It’s what helps you know which levers to pull to drive meaningful growth.
Stepping up your analytics game often means connecting multiple data sources and getting them to talk to each other, an effort that can feel time-consuming. This is precisely why we built Graphed. We simplify the entire process by connecting to your data platforms like Google Analytics in just a few clicks. Rather than spending hours in GTM and GA4 to set up tracking for every specific question, with Graphed you can just ask questions in plain English - like "Which blog author drove the most conversions last month?" - and get instant dashboards and answers in real-time. It turns sophisticated analysis into a simple conversation, so you can focus on insights instead of implementation.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.