Website integration overview
Grona runs on your website through one script snippet that you add to the top of every page’s <head>. This page explains what that script does on each page view, so you can reason about flicker, targeting and measurement, and it maps the rest of the website docs.
What the script does on a page
Section titled “What the script does on a page”The snippet has three lines: a preconnect hint to cdn.grona.ai, the anti-flicker script and the runtime script (main.js). Both scripts are built for your workspace and served from cdn.grona.ai. On every page view they do the following, in order.
- Hide the page. The anti-flicker script runs synchronously and hides the page body, so visitors do not see the original content change in front of them. Search crawlers and testing tools are recognised by their user agent and skip this step, and everything after it.
- Load the runtime.
main.jsdownloads asynchronously. It sets up a random visitor id in first-party storage, or reads the one it set earlier. - Check campaigns in priority order. For each active campaign, starting with the highest priority, the runtime checks the schedule, the UTM rules, the URL rules and any audience rules. The first campaign that enrols the visitor wins the page view, and lower-priority campaigns do not run on it.
- Apply a variation. The runtime picks the visitor’s variation. The choice is deterministic and sticky per visitor, so the same visitor sees the same variation on every page and visit on the same site address, unless you change the campaign’s traffic split. It downloads that variation’s changes from the CDN and applies them once the page is ready.
- Reveal the page. The runtime shows the page as soon as the changes are applied, or straight away if no campaign matched. A safety timer reveals the page 5 seconds after the anti-flicker script ran if the runtime has not finished by then.
- Measure. Once a campaign has enrolled the visitor, the runtime records the page view, scroll depth, time on page and clicks on elements it has tagged. Conversions you send with
grona('track', ...)are recorded on any page. Everything goes in batches toapi.grona.ai. While measuring every page is switched on for your workspace, the runtime also counts one page view on pages no campaign takes; see Data, privacy and security.
On single-page applications the runtime also watches for route changes and runs the campaign check again for the new address. See Single-page applications for what is and is not supported.
Install
Section titled “Install”Install the Grona scriptThe snippet and where it goes.
Verify your installationConfirm the script is on your pages.
Implementation checklistEverything to check before you go live.
Remove GronaTake the script and its storage off your site.
Configure
Section titled “Configure”Prevent flickerHow the anti-flicker script works and its trade-offs.
Single-page applicationsRoute changes, re-renders and their limits.
Server rendering and hydrationAvoid conflicts with frameworks that hydrate.
Content Security PolicyThe directives the script needs.
Consent and storageConsent modes and every storage key Grona uses.
Consent platformsWhich consent tools Grona reads.
Page variablesThe fields and rules for page-variable targeting.
Visual editor requirementsWhat a page needs for the editor to open it.
Domains and subdomainsHow visitor ids behave across hosts.
PerformanceRequests, caching and page-speed effects.
Supported browsersWhich visitor browsers the script runs in.
Platform guides
Section titled “Platform guides”How-to guides
Section titled “How-to guides”Preview and QA a variationCheck a variation on your live site before launch.
Target pages with URL rulesOne page, a group of pages or the whole site.
Target audiencesLocation, device, language, time and earlier visits.
Target visitors by page variableTarget a page variable from an API campaign.
Track conversions and custom eventsSend goals with the JavaScript API or a goal snippet.
JavaScript APIThe public grona() command.
Debug in the browserSee what Grona did on a page.
TroubleshootingFixes organised by symptom.
FAQSEO, ad blockers, Core Web Vitals and more.