Skip to content

Variables

Osvaldo edited this page May 13, 2023 · 6 revisions

Variables are easy to use ways to access data about the page, the user's browser or the current date+time.

They can be used in tags, both on the condition or procedure section. They can also be used in triggers.

Full list of current variables

Page

Path

container.variables.path

Title

container.variables.title

Referrer

container.variables.referrer 

Origin

container.variables.origin

Hash

container.variables.hash

Param

For example:

container.variables.param("utm_source")

Form values

For example:

container.variables.form("#myform") 

container.variables.form("#myform").email 

Current date + time (in the user's timezone)

Date

container.variables.now.date

Year

container.variables.now.year

Month

container.variables.now.month

Day

container.variables.now.day

Week day

container.variables.now.weekday

(1 is Sunday, 7 is Saturday)

Hour

container.variables.now.hour

Minute

container.variables.now.minute

Timezone

container.variables.now.timezone

Timezone offset

container.variables.now.timezoneOffset

Cookies

Cookie handling variables are useful mainly to integrate with a cookie consent system using container.consent.

Please note that setCookie and deleteCookie may not work for certain cookies, depending on path and domain. Always test.

Set cookie

The first parameter is the cookie name, followed by cookie value and number of days until it expires.

container.variables.setCookie("foo", "bar", 5); 

Get cookie

container.variables.getCookie("foo"); 

Delete cookie

container.variables.deleteCookie("foo");