window.referlyAtlas so your code can send conversions, identify the visitor and pass consent. This page is the reference for that object. For what to install where, see Tracking script; for events sent from a server, see the Events API.
Load the tracker
Shopify loads the tracker through the Referly app’s theme app embed, and WooCommerce through the Referly plugin. Every other site pastes the snippet from Store settings, under Tracking and connection, before the closinghead tag of every page:
attribute
required
The marker the script uses to find its own tag. Without it the script does nothing. Frameworks that need a value accept
data-affiliate="".string
required
Your store id, already filled in on the snippet Atlas gives you.
'1'
required
Turns Atlas mode on for this tag. The snippet Atlas generates always carries it.
'1'
On every form submit, reads an email input (
type="email", or a name containing “email”) and a phone input (type="tel", or a name containing “phone”) and calls identify with them. Opt in; off by default.string
Your IAB TCF v2 vendor id. With a TCF banner on the page, the tracker reads purpose 1 and, when this is set, the consent given to your vendor as well.
-
Fetches the store’s configuration from
GET https://www.referly.so/api/atlas/config?programId=YOUR_STORE_ID:enabledisfalsefor a store that is not tracking yet or has been disabled; the API then becomes a no-op andgetVisitorId()returnsnull.googleAdslists the store’s enabled Google Ads pixels, each with the event filter rules the tracker applies before it fires a conversion in the browser; it is empty on Shopify, where the custom pixel fires them. The configuration is cached in the browser and refreshed in the background once it is older than 10 minutes, so a pixel or filter change reaches visitors within about 15 minutes. -
Sets the visitor cookie
_rly_vidon your root domain for as many days as the store’s Visitor cookie setting allows (400 by default), and a session id in_rly_sid. A session ends after 30 minutes without activity. -
Records a PageView. The first event of a session carries the landing URL, the referrer, every
utm_*parameter plusutm_id,adset_id,ad_idandplacement, the click ids (gclid,gbraid,wbraid,fbclid,msclkid,ttclid,twclid,li_fat_id,rdt_cid,sccid,epik,tblci,gad_source) and the platform cookies it can read (_fbp,_ttp,_scid,_rdt_uuid,_shopify_y). - Replays any queued commands, and records a new PageView on each single-page navigation.
track(name, props)
Sign up, sign_up and SignUp all resolve.
PageView is automatic and cannot be sent. ViewContent is also detected on its own on Shopify and WooCommerce product pages and on any page with JSON-LD, OpenGraph or data-rly-* product markup (see Product markup).
Properties for site and checkout events
number
The amount of the event. Strings that parse as numbers are accepted.
string
Three-letter code, uppercased for you.
string
Your order id, for
Purchase. It deduplicates the order against the copy that arrives from your platform or server. Up to 128 characters.array
Up to 50 items. Each needs an id (
id, productId or sku, with name as a last resort) and may carry variantId, sku, name, price, currency and quantity (defaults to 1). Items without an id are dropped.string
The cart token, when your platform has one.
string
The checkout token, when your platform has one.
Properties for conversions
Lead, CompleteRegistration, StartTrial and Subscribe take the same value and currency, plus the person:
string
The conversion id. It deduplicates repeats, such as a reload or the same trial also reported by Stripe.
eventId, userId or subscriptionId are read when id is missing.string
Lowercased and trimmed in the browser, hashed by Atlas before it reaches a platform.
string
The person’s phone number.
string
The person’s first name.
string
The person’s last name.
string
Your own customer id.
userId is accepted as an alias.identify for you.
A purchase sent from the browser waits 60 seconds for the matching order from your platform or server (same order id) and is enriched with it, so send the same id in both places.
referly-atlas:event on document for every call, with detail.name and detail.props.
identify(traits)
email, phone, firstName, lastName and externalId (userId works too). Empty or malformed values are ignored; an email must contain @. Nothing is hashed in the browser; Atlas hashes the email, phone, names and external id with SHA-256 before anything reaches an ad platform.
Where consent is required and not yet granted, the identity is held and sent as soon as the visitor consents. Call it at sign up, sign in and checkout, and on any page where you know who the visitor is. data-atlas-autodetect="1" does it for you on form submits.
consent(…)
marketing: false) overwrites the stored choice. Signals from Shopify’s Customer Privacy API and from an IAB TCF v2 banner still win when they fire.
What the choice does depends on the store’s Consent mode in Store settings:
The tracker dispatches
referly-atlas:consent on document whenever the effective consent changes, with detail.marketing, detail.analytics and detail.implicit (true when no answer was needed). Google Ads conversions fired by the tracker follow Google Consent Mode: denied by default in consent regions until marketing consent is granted, unless the store’s consent mode is Off.
getVisitorId() and the queue
_rly_vid cookie. Before the tracker has loaded it reads the cookie (or its local storage copy) directly; it returns null when Atlas is disabled for the store or the visitor has no id yet. Use it to tie a server-side event to the visit: send it as visitorId to the Events API, or put it in your own checkout metadata as referly_vid for the billing integrations (see Connect your data).
The script loads asynchronously, so code that runs before it can queue commands. Two styles work:
referlyAtlas.loaded is true once the tracker has finished loading and the real methods are in place, and referlyAtlas.push([...]) keeps working after that.
Product markup
ViewContent is recorded automatically when the tracker can tell which product the page shows. It reads Shopify and WooCommerce product pages, JSON-LD Product objects and OpenGraph product tags (og:type, product:price:amount, product:price:currency). On any other page, mark one element up:
string
required
The product id. Without it the element is ignored.
string
The variant id, when you sell variants.
string
The SKU.
string
The product name.
number
The unit price.
string
Three-letter currency code.
Stripe elements
Stripe Checkout runs on Stripe’s domain, so the visit is handed over in the checkout’s client reference id. The tracker sets it torly_<visitorId> on every Stripe Buy Button and Pricing Table on the page (the client-reference-id attribute) and on every payment link to buy.stripe.com or donate.stripe.com (a client_reference_id query parameter), including elements added later by a single-page app and links clicked before they were tagged. A reference your site set itself is never replaced, so affiliate ids passed there keep working.
Under Strict consent mode nothing is tagged until the visitor consents. For your own Checkout Sessions, pass the visitor id as referly_vid in the session metadata instead; the Stripe integration reads both. See Connect your data.
Debugging
Adddata-atlas-debug="1" to the script tag, or turn on debug mode for the program, and open the browser console. Every line starts with [Referly Atlas]:
Then check the other end. Live activity in Atlas shows every event as it arrives, with its Status and the reason it was Skipped, Filtered or Deduped, and Test connection in Store settings confirms the script was seen.
Purchases arrive without a customer
Purchases arrive without a customer
Purchase ignores identity props. Call identify first.Nothing is sent and getVisitorId() returns null
Nothing is sent and getVisitorId() returns null
The store is not live, so the configuration came back disabled. Finish the setup wizard and make sure a plan is active, then reload with the console open and look for
active.Events show as Skipped: Consent unknown
Events show as Skipped: Consent unknown
Under Balanced mode a visitor from a consent region has not answered the banner, and the store skips unknown consent. Wire your banner to
referlyAtlas.consent(...), or switch Visitors with unknown consent to Send the event if you accept the responsibility.Events from a staging site never arrive
Events from a staging site never arrive
Allowed domains in Store settings limits which hosts may send events. Add the staging domain, or leave the list empty while testing.