Web tag
A 2 KB script with no dependencies, served by go at /s.js. It captures the link token on
your landing page, reports the funnel, and decorates your store and app links so the token
reaches the app.
Drop-in
<script src="https://go.roiguru.net/s.js" data-key="pk_…" data-pasteboard="true"></script>
| Attribute | Meaning |
|---|---|
data-key |
your project's client key (pk_…), from the console's Setup screen |
data-endpoint |
optional; the API base, default is the script's own origin |
data-pasteboard |
optional; true opts in to the iOS clipboard hand-off on store taps |
npm
import { init, track } from "@roiguru/go";
init({ key: "pk_…", endpoint: "https://go.roiguru.net", pasteboard: false });
Both forms expose window.rgo with init, track, token and flush. The tag never
overwrites an existing window.rgo and never throws into the page.
What it does on load
- Reads
golfrom the URL and stores it first-party (local storage and a cookiergo, 30 days,SameSite=Lax,Secureon https) together with the time it was acquired. A different token replaces the stored one; the same token keeps it. Without storage (private mode) it lives for the page. - If the URL carried a token, sends a
landevent. - Decorates store links and app links (below).
Store links
<a data-go-store="android" href="https://play.google.com/store/apps/details?id=com.example.app">Get it on Google Play</a>
<a data-go-store="ios" href="https://apps.apple.com/app/id123456789">Download on the App Store</a>
- Android: the Play Store URL gets
&referrer=gol%3D<token>at load, so right-click and new-tab work too; a tap sendsstore_click. The library reads the Play Install Referrer once after install and sendsinstallwith the same token. - iOS: a tap sends
store_click. Withdata-pasteboard="true"the tag writeshttps://go.roiguru.net/p/<token>to the clipboard inside the tap and follows the link once the write settles. The library reads it once, on first launch, only if the clipboard holds a web URL.
App links
<a data-go-applink href="https://example.com/app/job/123">Open in the app</a>
gol=<token> is appended at load, existing query preserved, so a Universal Link or App
Link tap carries the token into the app and its open event is attributed.
Custom events
rgo.track("apply", { value: 1, attrs: { plan: "pro" } });
Sends a custom event named apply with the stored token. value is a number; attrs
is a flat object of scalars (at most 2 KB). Returns false and sends nothing when no token
is held or attrs is nested.
Delivery
Every event carries a UUID event_id and a random per-browser device_nonce. Events queue
in local storage (at most 100), go out with fetch and keepalive so a store_click
survives the navigation, are removed on 202, retried after 1.5 s and on the next page load
for network errors, 429 and 5xx, and dropped on other 4xx. Retries reuse the same
event_id, so nothing is counted twice.
What it never sends
Only the event fields: type, name, value, attrs, token, timestamps, event_id,
device_nonce, platform. Never cookies, the page URL, the referrer or the user agent.