About built-in variables

Tag Manager

Video tutorial: watch on YouTube

Here’s a list of built-in variables in Piwik PRO. You can use them in tags, triggers and other variables.

Variable name Description Data layer property key
Click ID This variable contains the ID of the clicked element. elementId
Click Url This variable contains the URL of the clicked element. elementUrl
Click Classes This variable contains the class(es) of the clicked element. elementClasses
Click Element This variable contains the DOM object of a clicked HTML element. element
Form ID This variable contains the ID of the submitted form’s element. elementId
Form Url This variable contains the URL of the submitted form’s element. elementUrl
Form Classes This variable contains the class(es) of the submitted form’s element. elementClasses
Form Name This variable contains the name of the submitted form. elementName
Event This variable contains the name of the given event pushed to the data layer. event
Time on website This variable changes its value when the visitor has been on the website or page for a certain amount of time. For example, it fires a tag when a visitor has spent at least 15 seconds on a page or website. timeOnWebsite
Page Scroll This variable changes its value when a visitor scrolls to the chosen point on a page. For example, a visitor scrolls the page 50% or up to 1440 pixels.
Leave content This variable changes its value when the cursor leaves a page. You can choose one of two options for this condition: page exit intent (the cursor leaves a page via the top edge) or cursor leaving the browser’s area (the cursor leaves the page via any edge). edge
Page Url This variable contains the full URL of the current page.
Page Path This variable contains the path of the URL of the current page.
Page Hostname This variable contains the hostname of the URL of the current page.
History source This variable contains information about the last method or event that updated the history object. It changes its value when a pushState, replaceState, popState or hashchange event occurs. historySource
History state This variable contains the current HTML5 history state. newHistoryState
Old history state This variable contains the previous HTML5 history state. oldHistoryState
History fragment This variable contains the current anchor (#) in the page URL.
Old history fragment This variable contains the previous anchor (#) in the page URL. oldHistoryFragment
View within session This variable contains the amount of time (in seconds) that has elapsed since the last interaction.
Referrer This variable contains the page URL that linked to the current page.
External referrer This variable contains the URL of the page that generated traffic to your website.
Campaign This variable contains the value from the utm_campaign or pk_campaign parameter placed in the URL.
Traffic source

This variable can be any of the following: campaign, organic_search, social, website, direct or undefined (in that order).

If a visitor arrives at your site from a different source during the same session, the variable value will be updated — but only if the latter source has a higher priority than the former (example: was social -> is campaign).

Supported campaigns: pk_campaign, utm_campaign

Supported organic_search values: google, yahoo, bing

Supported social values: facebook, twitter, linkedin, youtube

If the visitor cannot be qualified for any of these sources, we set the value as direct or website.

Returning Visitor This variable shows if this is the visitor’s first visit or not.
Consents This variable contains information about the current and previous state of visitor consent. Consents
Found elements This variable is used in the element presence trigger. If the trigger finds the element(s) it is looking for, the variable will contain the CSS selector used in the trigger. foundElements

Was this article helpful?

Technical support

If you still have any questions, visit our community.
There’s always someone happy to help!

Back to help center