Skip to content

How to Use Extracts to Track Action Data with Custom Dimensions?

One of the key features of custom dimensions is the ability to track custom data associated with actions, as page views. This often requires you to add custom code to your site or use a tag manager. However, you can also collect data directly from a page URL, page parameters, or page titles with help from MVMCloud Analytics's built-in extraction feature.

Each site is unique, so the custom dimensions and values you choose to focus on will likely vary. Additionally, there may be different methods for collecting the same information depending on how your website is set up. On this page, you will find general instructions on how to configure each extraction type, along with an example of when and how you can use a particular type of extraction.

It's important to remember that extracts can only be used on custom dimensions with Action scope. You can learn More about scopes in the Custom Dimensions guide.

How to Configure Custom Dimension Data Extracts

You can configure extracts on the configuration page for the custom dimension they are associated with. You can access your custom dimensions by clicking the gear icon Administration icon in the right side menu. Once there, find the Sites link in the Main Navigation on the left side and click the Custom Dimensions link.

Personalized dimensions menu

Once on the Custom Dimension page, scroll to the Action Dimensions section. Then click the big green button to create a new dimension or click the edit icon Icon dimension to configure an existing one.

You can find the relevant settings for creating and managing extracts under the Extract Value heading.

Extraction of values

Your next steps will vary slightly depending on the type of extraction you need.

Extract the value using RegEx (Regular Expressions)

When configuring extracts via Page URL and Page Title, you will need to use RegEx search patterns. Learn all RegEx variables are beyond the scope of this document. However, an important aspect unique to its use with dimensions custom expressions for MVMCloud Analytics is that the first expression in square brackets will extract the value to set against the dimension. To provide some examples:

Custom Dimension for Page ID via Page URL

  • Site URL path:/news/780546/new-nightvision-camera/
  • Search pattern RegEx:/news/(.)/./
  • Extraction Result:780546

Custom dimension for author pages via page title

  • Website page title:Posts by Maria Clara
  • RegEx search pattern:Posts by (.*)
  • Extraction Result: Maria Clara

If you are not familiar with regular expressions, it is highly recommended that you learn about regex before using it and always remember to extensively test your RegEx patterns.

Note: you do not need to escape slashes using backslash (), as MVMCloud Analytics does this for you automatically. For example, use /news/ instead of \/news\/.

Page URL Extraction Example

To use the scraping feature on page URLs, the data you plan to crawl must be accessible from the URL. An example use case for URL extraction is tracking the language of a visit to a multilingual website. In the following URL structure, the language code for English en is clearly indicated:

https://example.com/lang-en/plugin/

In the URL above, the first part contains the domain https://example.com/. This is followed by the section where the lang-language is set to the two-letter en language code representation for English. Finally, the rest of the way is specific page someone is viewing. Following this same structure, the equivalent page in Portuguese would have the following:

https://example.com/lang-pt-br/plugin/

Because these pages share a common structure, you can safely extract the locale with a RegEx (regular expression) pattern targeted to the locale. For the example URL structure above, you can use the RegEx pattern /lang-(.*)/.*/ to capture the code of the language as shown in the screenshot below:

URL language extraction

The regex above looks for the initial /lang-prefix in the URL and then the wrapped wildcard (.*) extracts the language code to associate with the custom dimension. Finally, there are two forward slashes with a wildcard in between /.*/ to ensure that the RegEx pattern captures all pages with a language prefix.

Once this custom dimension is created, you can test it by visiting any page that follows the same URL structure. To confirm that the data is being tracked properly, you must access the Visit Log, Find your specific visit and hover over the URL to see the associated custom dimensions. In the screenshot below, You can see that as an example of the language dimension of the page.

Visit log

This is just one example of a regex pattern in use. You can create very advanced patterns depending on your specific URL structure. There is another example of RegEx in use in the Page Title section below.

Page Title Extraction Example

Although page titles are usually unique to each page, they often share partial similarities. For example, you can include the word Blog for each blog post or Members Area for the members-only sections of your website. Consider these example page titles for two blog posts:

  • “New smartphone makes your coffee – Technology -Articles”
  • “Why you need to use Analytics – Marketing -Articles”

Although the first half appears to change for each article, there is a clear pattern for the second part of the title, which includes the category in which the blog post is, for example, Technology or Marketing. If this pattern is consistent across your site, you can create a RegEx pattern designed to extract the blog post category. In this case, you can use the following pattern:

.*–\s(.*)\s-Articles

The break of the individual components in the above pattern .* matches any number of characters, until starts looking for the break in the title. Then, \s represents a space character to avoid unnecessary spaces in the custom dimensions value. Then the wrapped wildcard (.*) selects the actual category text, before the final space character \s and Articles closes the pattern. Therefore, the values extracted from the RegEx example above would be the words shown in bold below:

  • “New smartphone makes your coffee – Technology -Articles”
  • “Why you need to use Analytics – Marketing -Articles”

Page Parameter Extraction Example

Page parameters are elements displayed at the end of your URL. They often contain arbitrary data for a variety of reasons, some of which you may want to configure custom dimensions. The first parameter within a URL is preceded by a ? and all subsequent parameters are separated by a &.

For example, some affiliate programs (where people drive traffic to a website for a fee) track referrals through query parameters. This would look a little like the following URL where ref is the query parameter and affiliate is the parameter value:

https://example.com/plugin/?ref=affiliate

If you are running an affiliate program this way, it might be helpful to create a custom dimension that tracks which page views were referred by affiliates and which affiliates are generating the most traffic.

Parameters are a little easier to configure than page URLs as they don't require RegEx. Instead, you just need to specify the parameter that should be tracked.

URL parameter extraction

After you configure matching, you can test that it is working by visiting a URL that contains your page parameter and then finding your page preview. page in the Visit Log in the left menu Visitors >> Visit Log.

Visit log

More Features

You can learn more about reporting and analyzing these values in the complete custom dimensions guide.