1. Gravity Field Script
1. Implementing preconnect, prefetch & core.js scripts
On every site page in the <head>
section:
Additionally, on every site page in the <head>
section core.js script must be implemented:
2. Implementing GF, Section ID, Page Context variables
Each page must declare a GF variable. It is declared within a separate script consisting of three parts:
GF variable itself;
GF.section
- unique section ID which must be of string type;GF.pageContext
- variable passing the information about the page context and its description. In the Page Context you can pass a localization parameterlng
. You can uselng
in the case that your site/app is available in more than one language/region and personalization campaigns need to adjust content according to the language/region. You can also use this parameter if there are different product attributes (price/discount amount, etc) in different regions/cities. More about page context: 2. Page Context
More about scripts: Gravity Field Scripts Workflow
Appendix
Example of correctly installed scripts on the shopping cart page:
Script connection order:
Preconnect and prefetch;
Declaring the GF variable and specifying a Page Context;
Core.js.
Last updated
Was this helpful?