JavaScript Reference
Our script exposes a number of functions and properties that can be used to programmatically control the consent solution.
In all of these, the consent categories that we support are handled:
- undefined = Undefined cookies that have not yet been defined in our application.
- necessary = Strictly necessary cookies
- functional = Functional cookies
- statistical = Statistical cookies
- marketing = Marketing cookies
Below is a reference of the methods we officially support, any usage beyond this is not officially supported and its functionality will not be guaranteed. This includes things like reading our cookie directly or extracting other information from properties not listed below. If you have a need that is not covered by our current API surface, please contact us and we will do our best to find an official way to support it.
cookieTractor.openConsentSettings()
This method opens the cookie dialog in the visitor's browser.
cookieTractor.consent.contains(categoryAlias)
This function returns true/false based on whether a consent for the current category exists.
cookieTractor.consent.add(categoryAlias)
Adds a consent for the current category. This method can be called with a string or with an array of strings if several categories are to be added.
cookieTractor.consent.remove(categoryAlias)
Removes/revokes consent for the given category alias.
cookieTractor.consent.key
Contains the visitor's unique consent key/id.
cookieTractor.consent.current
An array of strings with categoryAlias for the consents currently given by the visitor.
cookieTractor.consent.available
An array of strings with categoryAlias for all categories available on the current website. This is not the visitor's choice but only a reference list of the categories used on the site.
cookieTractor.category.{categoryAlias}
Properties that contain string representations of our cookie category aliases.
cookieTractor.cookie.remove()
Removes our consent cookie from the visitor's browser
cookieTractor.cookie.remove(cookieName)
Helper method that attempts to delete a cookie with the name from the method parameter cookieName.