About built-in variables

Tag Manager

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

Variable name Description
Click ID Contains the ID of the clicked element. It changes its value when a visitor clicks an element with the chosen ID.
Click Url Contains the URL of the clicked element. It changes its value when a visitor clicks a link with the chosen URL.
Click Classes Contains the class(es) of the clicked element. It changes its value when a visitor clicks an element with the chosen CSS class.
Click Element Contains the DOM object of a clicked HTML element.
Form ID Contains the ID of the submitted form element. It changes its value when a visitor submits a form with the chosen ID.
Form Url Contains the URL of the submitted form element. It changes its value when a visitor submits a form that sends a request to the chosen URL.
Form Classes Contains the class(es) of the submitted form element. It changes its value when a visitor submits a form with the chosen CSS class.
Form Name Contains the name of the submitted form.
Event The name of the event emitted on a data layer. It changes its value when a chosen custom event occurs in a data layer.
Time on website It changes its value when the visitor is on the website or page for a certain time. For example, it fires a tag when a visitor spends at least 15 seconds on a page or website.
Page Scroll It changes its value when a visitor scrolls to the chosen point on a page. For example, the visitor scrolls 50% of a page or scrolls to 1440 px on a page.
Leave content It changes its value when the cursor leaves a page. You can choose 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).
Page Url Contains the whole URL of the current page.
Page Path Contains the path of the URL of the current page.
Page Hostname Contains the hostname of the URL of the current page.
History source 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.
History state Contains the current HTML5 history state. It changes its value when a history state meets a defined condition.
Old history state Contains the previous HTML5 history state. It changes its value when a previous history state meets a defined condition.
History fragment Contains the current anchor (#) in the page URL. It changes its value when an anchor (#) in the page URL meets a defined condition.
Old history fragment Contains the previous anchor (#) in the page URL. It changes its value when an anchor (#) in the previous page URL meets a defined condition.
View within session Contains time in seconds from the last interaction.
Referrer The page URL that linked to the current page.
External referrer The URL of the page from the website with a different hostname that linked to your current website.
Campaign Its value based on the utm_campaign or pk_campaign parameter from the URL.
Traffic source

Can be one of: campaign, organic_search, social, website, direct, or undefined (in that order).

If a visitor comes from another source during the same session, the variable value is updated — but only if the latter source priority is higher (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

When a visitor can’t be qualified as any of those sources, we set direct or website (if there was a third-party referrer).

Returning Visitor Logical condition which says if this is the visitor’s first visit or not. It changes its value when a returning visitor clicks an element on the chosen page (this mechanism is based on the cookie).
Consents Contains information about the current and previous state of visitor consent.
Found elements Variable used in the element presence trigger. It contains the class name of the found elements that the trigger was set to look for.

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