Working with Templates
Last updated
Was this helpful?
Last updated
Was this helpful?
Created: 28.11.2023 Updated: 28.11.2023 Author: Alexander Sugakov
The template functionality in the Gravity Field platform offers users several advantages:
Significantly speeds up campaign creation: There's no need to repeatedly write the same code. Once written, the code can be reused multiple times.
Enables launching campaigns without developer assistance: Business users can choose a ready-made template, replace necessary settings of elements (text, color, etc.) directly in the platform interface using variables, and launch the campaign.
Reduces the volume of the personalization platform script in case of front-end implementation: When using templates, the script store the full code of all variations linked to the template but only the values of variables and the template itself.
New templates can be created in two ways:
Through a dedicated template page available in the menu Assets → Templates.
For front-end campaigns, templates can be created directly from the variation editing window using the "Save as Template" button in the upper right corner of the variation editing window.
When creating a template from scratch, you need to select the type of campaign which this template will apply. You will only be able to choose this template from the list when creating a campaign of the corresponding type. Additionally, when creating a template, you have the option to upload an image that will be displayed in the template list when creating a campaign.
You can edit the template through the page available in the menu Assets → Templates. Changing the template affects all variations created based on this template. If necessary, after changing the template, you need to manually update the versions of experiences created from this template.
Variations based on templates created in the section (as opposed to standard platform templates) are tied to templates. Editing the code of the campaign becomes unavailable in this case. For front-end campaigns, variations tied to templates take up less space in the script of the personalization platform. To edit these variations, you need to either modify the template or unlink the variation from the template (which will transfer all variation code to the script). We recommend creating additional variables in the template for minor changes, allowing you to make these changes without altering the variation code.
When creating personalization campaigns, depending on the chosen campaign type, you will be presented with a set of pre-configured templates. Templates allow you to quickly launch campaigns with one of the basic design options.
The switcher at the top of the page allows you to choose between standard Gravity Field templates and templates specifically designed for your website or application.
After selecting the template, the campaign is created following the regular sequence (Frontend campaigns creation or API campaigns creation), and when entering the variation editing mode, the chosen template is loaded.
When working with templates, the following elements are available:
Save the current state as a new template.
Toggle between preview mode and preview the current state on the website (only for front-end implementation).
Switch between variable view modes, HTML, CSS, and JS of the template.
Work with variable grouping.
Configure variables. When changing variable values, visualization changes in real-time.
Preview the visualization (only for campaigns of types Dynamic Content, Recommendations, Overlay, Notification).
Save the current state of the variation.
Any HTML/CSS/JS code element can be assigned a variable. Variables facilitate the configuration of campaigns, allowing business users to customize campaigns without the need for developers, providing them with the ability to replace text, images, colors, and other design element parameters directly from the platform interface. More details: Working with Variables in Variations