Skip to content
Page-variable targeting works with Public API campaigns, available on request. Email support@grona.ai to get access.

Page variables

This page is the reference for page-variable targeting, a feature for campaigns created through the Public API. Your site sets a variable on window, and the campaign shows its variation only when that variable holds the value the campaign names. For the step-by-step setup, see Target visitors by page variable.

Field Holds Example
segmentId The name of the page variable your site sets on window audience_id
segmentValue The value the variable must equal for the visitor to see the variation returning_buyer

Leave both out to target every visitor the campaign’s page rules match. Campaigns built in the Grona dashboard have no page variable: their segmentId and segmentValue read back as null, and dashboard audience rules cannot read page variables.

Field Rule
segmentId Letters, digits and _, not starting with a digit, up to 128 characters: ^[A-Za-z_][A-Za-z0-9_]{0,127}$. Names the browser already defines on window, such as name, location, status, top, parent and history, are rejected.
segmentValue 1 to 128 letters, digits, _, ., : or -: ^[A-Za-z0-9_.:-]{1,128}$.

A request that breaks either rule is refused when you create or update the campaign.

  • The visitor sees the variation only if the variable exists and its value equals segmentValue exactly, as a string. Letter case counts.
  • Any other value, or no variable at all, does not match, and the visitor sees the original page.
  • The variable is read when Grona checks the campaign. A variable that does not exist yet at that moment counts as unknown, and an unknown value never matches, so set it in an inline script above the Grona snippet.
  • Page-variable targeting adds to the campaign’s page rules. The page must match those rules too.
  • Preview links skip targeting, so they show the variation whatever the variable holds.