Script tag
Connect the browser SDK with one script tag, with SPA routing and page variables.
Basic usage
<script
async
src="https://cdn.soobro.com/sdk/v1/geo.js"
data-site="pk_live_xxxxxxxx"
data-locale="auto"
data-mode="fill"
></script>| Attribute | Default | Description |
|---|---|---|
data-site | required | Site public key |
data-locale | auto | auto detects the language from the URL strategy; or hardcode such as en |
data-mode | fill | fill only adds missing head fields; replace overwrites with platform rules |
data-spa | true | Listen to pushState / popstate and re-match rules on navigation |
data-events | true | Report page_view and rule_match events (no cookies, aggregated only) |
The script is under 12 KB gzipped, loads async and never blocks rendering; the first head update usually completes within 150 ms.
Page variables
Template variables such as {title} and {author} can be registered by the page:
<script>
window.geo = window.geo || [];
window.geo.push(['set', { title: 'Smart home buying guide', author: 'Acme Editorial', cover: 'https://…/cover.jpg' }]);
</script>Or declare them as meta tags that the SDK reads automatically:
<meta name="geo:title" content="Smart home buying guide" />
<meta name="geo:author" content="Acme Editorial" />Events
window.geo.push(['on', 'ready', (config) => console.log(config.rule?.id)]);
window.geo.push(['on', 'rulematch', ({ rule, path }) => {}]);
window.geo.push(['on', 'error', (err) => {}]);Degradation
If fetching the config fails (network, paused site, wrong key) the SDK leaves the existing head untouched and emits error; the site renders as before.