On Your Site
Local Development
Site Code
Guides
Site Configuration
Content Management
Forms
Form API
Templates
Content Management
Campaign Values
Campaign Values allow you specify text which changes dependent on campaign, language and country. They are intended to be used by developers more than end users. They allow you to specify things like tracking codes or other values that need to change in the template depending on the campaign, country or language.
As Twig functions they can be used to make decisions in the template that are not related to content but need to change depending on country, language or campaign. Of course, they can also be used to manage content if that works for you.
Campaign Values can be used in templates in the following way:
{{ campaign_value('utm_source', 'default') }}
The first parameter utm_source
is the name of the Campaign Value you wish to
fill in, the second paramete default
is the default if no campaign value is
set.
Precedence
Campaign Values are loaded in the following order:
- Specific value for campaign, language and country
- Default value for campaign and language
- Default value for campaign
- Default value specified in template