RTN Docs

Web SDK · v0.6.0

Quick Start

Install the RTN Web SDK 0.6.0 with one snippet and send your first consent-aware event.

1. Add the SDK snippet

Paste these two tags inside <head> on every page. Replace WRITE_KEY with the key for your site; the dashboard's Integrations page shows the snippet with your key filled in.

<script src="https://cdn.adrtn.app/sdk/rtn.min.js"></script>
<script>
  rtn.init('WRITE_KEY', { consent: 'pending' });
</script>

Keep both tags as they are and do not add async or defer: the second tag runs once the SDK has loaded, so rtn is defined for every call your pages make afterwards (rtn.productViewed(...), rtn.orderCompleted(...)).

The SDK derives its event endpoint from the script URL, so you do not need to configure an endpoint. See Configuration for every init option.

Choose a script URL

URLBehavior
/sdk/rtn.min.jsRecommended. Stable alias that always serves the current compatible release, so you never edit the snippet to upgrade.
/sdk/0.6.0/rtn.min.jsImmutable, pinned release for teams that upgrade deliberately.
/sdk/v0/rtn.min.jsLegacy alias that keeps pointing at the latest 0.x release.

If you must load the SDK asynchronously, call rtn.init from the script's onload handler and make no other rtn calls before it runs: until then window.rtn does not exist, and a call such as rtn.productViewed(...) would throw on your page.

Without a stored decision or a consent option, the SDK starts as granted. If you run a consent manager, initialize with consent: 'pending' as above and call setConsent when the visitor decides:

rtn.setConsent('granted');

See Consent for purpose-level decisions and pausing.

3. Send your first event

Track a meaningful customer action.

rtn.track('newsletter_viewed', { placement: 'footer' });

4. Verify delivery

Open your browser network panel and filter for v1/batch to confirm accepted requests. SDK 0.6.0 sends schema_version: 2 batches.

A successful ingest request returns HTTP 202. Continue with Identify Users when you are ready to connect anonymous activity to a customer.

Using a bundler

import { createClient } from '@rtn/web-sdk';

const rtn = createClient({
  writeKey: 'WRITE_KEY',
  endpoint: 'https://cdn.adrtn.app',
  consent: 'pending',
});

With a bundler, endpoint is required and must be the ingest base URL without /v1/batch.

On this page