Create a custom variable in Analytics (classic)

Analytics classic

A custom variable lets you send an additional parameter to Piwik PRO. It’s an older version of custom dimension so we recommend using custom dimensions instead. But if you need to use custom variables, here’s how to set them up.

About the scope

There are two scopes in custom variables:

Page scope: The variable is attached to the page view, showing additional info about the single view. It can, for example, represent the language in which the page was displayed. Or maybe your pages have some categories that are not represented in the URL or page title but still you would like to know about them. A more technical use case is checking which server has actually served the page in case of the load-balanced cluster.

Visit scope attaches additional information to the current visit. Let’s say your website is a clothes shop. Your visitors log in and leave a lot of info about themselves that is not tracked by default. Their sizes, their names, their gender etc. All of those parameters can be tracked as a custom variable in the scope of visit. Or maybe you track intranet website for thousands of employees. You can attach the custom variable to them representing their job title, the location of their work or their department.

Note: The visit custom variables stores the information in a first party cookie which expires at the end of the visit so if the same visitor visits your page again after a while his variables will be empty and will have to be set again.

Set up tracker

In Tag Manager, you can add a custom variable of any scope to the tracker.

To add a custom variable, follow these steps:

  1. Go to Menu > Tag Manager.
  2. Navigate to Tags.
  3. On the left, select Piwik PRO.
  4. In Custom variables, click + Custom variable.
  5. Add a number (you can pick the slot number you want), name, value, and scope.
  6. Note: If you want to grab a piece of information from your website and pass it to Analytics, you need to create a variable in Tag Manager. The new variable will appear on the list of values (when you click the (x) button).

  7. When you’re done, click Save for the tag.
  8. Click Publish to make the tag go live.

Custom variable report

In Analytics (classic), each custom variable can be analyzed in the custom variable report.

To access the report, follow these steps:

  1. Go to Menu > Analytics.
  2. Navigate to Visitors.
  3. Click Custom Variables.

Limitations

Custom variables are limited as each of them is represented by an additional column in the database. Piwik PRO accounts have 10 custom variables for each scope. If you would like to raise the amount of the variables just let our support team know and they will coordinate the change for you.

Was this article helpful?

Be the first to rate this article.

Technical Support

If you have any questions, drop us a line at support_SPC@piwik_SPC.pro.

We’re happy to help!