Websites (Hardcoded)
Steps to hardcode TrustCommander on websites.
Last updated
Steps to hardcode TrustCommander on websites.
Last updated
TrustCommander can be directly integrated with websites. The setup requires technical installation steps.
Following you will find the required steps to implement a standard TrustCommander setup.
Choose the default account configuration mode for your account (see Options).
Setup your TrustCommander categories & vendors (see Manage Categories).
Create one or multiple banner templates (see Manage Banner)
Deploy your TrustCommander banner templates to the Commanders Act CDN or on premise target (see Deploy Banner).
Install TrustCommander tag (see below)
Manage onsite tags with TrustCommander (see below).
To hardcode TrustCommander on websites you need to add following JavaScript tag to your website. This snippet should be added to the <head>
of your website.
{{ privacy_tag_url }}
has to be replaced with your privacy JavaScript tag URL. This URL can be found in the GENERATE & DEPLOY
tab of each privacy banner.
TrustCommander can manage onsite JavaScript tags by wrapping them in a script tag with a custom MIME type.
This approach only works when you install TrustCommander in the <head>
of the document (e.g. not when injecting the TrustCommander tag via Google Tag Manager)!
This TrustCommander wrapper does only fire that wrapped JavaScript code in case a visitor provided consent for the specified privacy category ID.
The <script>
has to have type="text/tc_privacy"
.
{{ tag_javascript_code }}
has to be replaced with the JavaScript code of the tag you want to manage with TrustCommander.
{{ category_or_subcategory_id }}
has to be replaced with the category or sub-category of the TrustCommander category that should manage this tag (see Manage Categories). Be careful when you create sub-categories associated to a category: you have to enter the sub-category ID in the attribute, not the category ID, as the user will be able to activate or deactivate only sub-categories and not the main category in the banner:
{{ vendor_id }}
has to be replaced with the vendor ID of the vendor related to the tag (Only available when native vendors are activated for the account).
Following examples shows how you would manage a Criteo Tag based on a TrustCommander category named "Retargeting".
Retargeting was assigned to sub-category ID 6. In case a sub-category is used you should never use the main category (4 in this case) to manage tags.
The Tag wrapper for the Criteo JavaScript tag might look like this (example shortened):