Platform How it works Torii pixel Gates Call tracking Explore Integrations
Company For agencies Trust & data
Book a demo Sign in
The Torii pixel

One tag ties each lead and order to the ad click that started it.

The Torii pixel records every visit to your site with the ad and campaign behind it, and remembers them when the visitor comes back. Your gates, the rules that decide which leads and orders are sent on, can then judge each one by where it came from. It loads in the background, so it won't hold up your pages.

What it records

Each lead and order arrives with its ad, campaign and source attached.

All of this is recorded as soon as the tag is on the site. The one thing to add is a line of code where each lead or purchase happens, which we can set up with you. Form submissions, button clicks, scroll depth and video plays can be switched on with no code at all.

Page views

Every page, recorded automatically with its address and title.

Ad clicks

Clicks from Google, Meta and Microsoft ads, kept with everything that visitor does next, so each lead in Torii shows the ad click behind it.

Campaign and source

All five UTM tags, the website that referred the visitor and the page they landed on.

First and latest source

The first way each visitor arrived and the latest, both attached to every lead and order they go on to send.

Meta's browser IDs

Read from Meta's own pixel, so Meta can match the conversions Torii sends it. Keep Meta's pixel running on the site alongside Torii.

GA4 visitor ID

Read from your GA4 tag, so the conversions Torii sends to GA4 land on the same visitor.

Device and browser

For device reports in Explore, and for hiding likely automated visits from your charts.

Your conversions

Leads, purchases and sign-ups, each with its value, sent by one line of code where each one happens.

Code for your developer
Return visits

Days later, the lead or order still knows which ad it came from.

People often come back more than once before they enquire or buy. The pixel remembers the first and the latest way each visitor arrived, and sends both with every lead and order.

  • The first source is kept for 90 days and never overwritten.
  • The latest is kept for 30 days and updated whenever they come back through an ad, a tagged link or another website.
  • When they come back by typing your address in, the lead still picks up the campaign and ad click from their earlier visits. Your gates see the same details, so a rule on campaign still applies.
Three visits from one visitor, then a lead Visit 1 on 14 September arrives from a Google search ad, tagged google / cpc with a Google ad click, which saves the first source and the latest source. Visit 2 on 2 October arrives from a newsletter tagged newsletter / email, which keeps the first source and updates the latest. Visit 3 on 7 October has no UTM tags, ad click or referrer, so both are kept, and the visitor sends a £120 lead. The lead carries the first source, google / cpc from 14 September, and the latest source, newsletter / email from 2 October. The lead's own source is taken from the latest visit, and its Google ad click from the first. 14 SEP · VISIT 1 Clicks a Google search ad UTM tags: google / cpc Google ad click first source saved latest source saved 2 OCT · VISIT 2 Opens the newsletter UTM tags: newsletter / email no ad click first source kept latest source updated 7 OCT · VISIT 3 Types the address, fills in the form no UTM tags, ad click or referrer sends a £120 lead nothing new · both kept THE £120 LEAD CARRIES First source google / cpc · 14 Sep Latest source newsletter / email · 2 Oct Lead's source newsletter / email ← latest Lead's ad click Google · 14 Sep ← first
Beyond the contact form

The same tag covers sales made on the phone, on another site or at a Shopify checkout.

Plenty of businesses convert somewhere other than a form on their own site. Switch on whichever of these you need.

Affiliate, referral and booking sites

When the click out is the conversion, switch on outbound clicks. Every click on a link to another website, an email address or a phone number is recorded with where it went and which link it was, and the visitor carries on as normal. A gate can then count those clicks as conversions.

Code for outbound clicks

Enquiries by phone

Visitors who arrive from your ads see their own tracking number on the site, so when they ring, the call is tied to the ad that brought them, the same way a form is.

How call tracking works

A lander on one domain, the shop on another

Two domains usually split one person into two visitors, and the second has no record of the ad. With linked domains, the visitor's ad click and campaign tags go with them when they follow a link to your other site, so the sale is still tied to the original ad.

Code for linked domains

Shopify stores

On a Shopify store, the tag records each visit and the ad behind it. Checkout tracking adds the purchase itself, with its order value and the ad click that started it. A gate can then decide which orders go to Meta, for example only those over a value you choose. We set it up with you in Shopify admin.

  • The customer's email and phone are hashed before they're sent, never in plain text.
  • It follows the shopper's choice in Shopify's own cookie banner.
  • Reloading the thank-you page doesn't count the order twice.
  • Each order is also recorded from Shopify itself, with its real value.
  1. 1

    Your theme

    Online Store → Themes

    The tag goes into your theme and ties each visit and ad click to the shopper's cart, which Shopify carries onto the order.

  2. 2

    Checkout

    Settings → Customer events

    Records add to cart, checkout started, payment details added and the purchase, with the order value and the full basket.

  3. 3

    Orders

    Settings → Notifications

    Shopify tells Torii about each new and paid order, and Torii matches it to the checkout purchase so each order is one record.

Questions

Setting up and running the tag.

Each site gets its own pixel from Torii's Install pixel page. For an agency that's one per client, all under one login. Whoever looks after the site pastes in one tag, and you can check it's working from Torii straight away.

Leads and purchases then need one line of code each, where they happen. We set that up with you, and the steps for your developer are further down this page.

If the site runs Google Tag Manager, yes. Import Torii's template from the Install pixel page, paste the pixel ID and choose what to record, then send each lead or purchase from a Custom HTML tag on your form-submit or thank-you page trigger, using the version that waits for the tag to load. Then check it with Verify installation in Torii, which shows the events received in the last 24 hours.

Yes. Torii runs alongside them and reads the visitor IDs they set, so Meta and GA4 can match the conversions Torii sends. Meta needs those IDs, or a hashed email or phone number, before it can match a conversion, so keep its pixel on the site.

If another tool already sends the same conversion to Meta, such as Meta's pixel or Shopify's Facebook & Instagram app, choose which one reports it, or give Torii's version its own event name, so Meta doesn't count one sale twice.

Yes. List the domains a pixel belongs to and it only accepts website events from those. The launch check on each client shows every site a pixel has heard from, so you can spot one that shouldn't be there.

Yes, as an option. We set up a subdomain such as t.example.com with you, and the tag and its data then run through your own domain.

A random visitor ID, kept for a year; the first and latest way the visitor arrived, kept for 90 and 30 days; and a session ID that ends with the visit. If your site sends hashed contact details, it keeps those hashes too. Trust & data lists each one by name, ready for your cookie notice.

For your developer

Paste the tag into the site, then check it from Torii.

Everything from here down is for whoever looks after the site. Each pixel has its own ID on Torii's Install pixel page, with a Copy code button, and any options chosen there are written into the snippet, the same way the builder below works.

  1. 01

    Copy the tag

    From Install pixel in Torii. The pixel ID makes sure every event lands with the right client.

  2. 02

    Paste it before </head>

    On every page you want to track. It starts itself and records a page view straight away. In Google Tag Manager, import Torii's template or add it as a Custom HTML tag.

  3. 03

    Run Verify installation

    Torii confirms events are arriving and, given the site's URL, that the tag is on the page.

Install snippet
<script async src="https://app.toriidata.com/torii.js?id=YOUR_PIXEL_ID"></script>
Snippet options
Adds linker=. Install the same pixel on the other domain too. Use *.example.com for subdomains.

Confirm the install from inside Torii.

From the Install page, Verify installation runs two checks, so you can see the tag is working without opening the site's code.

  • Event check. How many events this pixel stored in the last 24 hours, and when the latest one arrived. Use this one for a tag manager install.
  • Tag check. Give it the site's URL and Torii fetches the page, looks for torii.js with this pixel's ID, and tells you if it finds a different one.
Developer reference

The JavaScript reference.

Page views need no code. Leads, purchases and anything else you want the gates to judge are sent with these calls, and the optional features are switched on with an attribute on the tag.

Show the referenceHide the reference

Torii.track(eventName, data?)

Sends a conversion, or any event you want gates to judge, with whatever you pass in data.

  • value becomes the event's value only when it's a number, so pass 120 rather than '120'.
  • currency defaults to GBP.
  • The whole data object is stored with the event.
  • Each event gets its own ID in the browser, so if the browser sends the same event twice, it's stored once.
  • Without an event name it logs a console error and sends nothing.
  • In a single-page app, call Torii.track('pageview') from your router after each route change; it picks up the new address and title.
track.js
// a lead, when the form is submitted
Torii.track('lead', { value: 120, currency: 'GBP' });

// a purchase, with your own order reference
Torii.track('purchase', {
  value: 99.99,
  currency: 'GBP',
  order_id: '12345'
});

toriiq.push([…])

The tag loads async, so code that runs before it queues its calls on toriiq. The queue is sent when the script loads, and after that toriiq.push sends straight away.

  • The queue takes track, identify, clearIdentity and consent calls. Call decorate once window.Torii exists.
inline, before the tag loads
window.toriiq = window.toriiq || [];
toriiq.push(['track', 'lead', { value: 120, currency: 'GBP' }]);

data-autotrack="outbound"

Fires an outbound_click event on a left or middle click on a link to another host, or on a mailto: or tel: link. Ticking Track outbound link clicks on the Install pixel page does the same.

  • The event carries the URL, domain, scheme, link text (up to 120 characters), link ID and whether the link opened a new tab.
  • It never holds up the click: the event is sent in the background as the page unloads.
  • Add data-torii-ignore to any link you don't want counted.
  • Subdomains count as other hosts, and www. is ignored.
index.html
<script async
  src="https://app.toriidata.com/torii.js?id=YOUR_PIXEL_ID"
  data-autotrack="outbound"></script>

<!-- counted: a link to another host -->
<a href="https://partner.example/book">Book with our partner</a>

<!-- not counted -->
<a href="https://partner.example/terms" data-torii-ignore>Terms</a>
outbound_click · data
{
  url: 'https://partner.example/book',
  domain: 'partner.example',
  scheme: 'https',
  link_text: 'Book with our partner',
  link_id: null,
  new_tab: false
}

Torii.identify({ email, phone })

Rolling out

Hashes email and phone with SHA-256 in the visitor's browser before anything is sent, so the plain text never leaves the page.

  • Email is trimmed and lower-cased. Phone is reduced to digits only: +44 7700 900123 is hashed as 447700900123. Pass numbers in international form, because the digits are hashed exactly as given.
  • The hashes are kept for 365 days and sent with every later event, as match keys for Meta.
  • Hashing is asynchronous and track() doesn't wait for it, so call identify() as the fields are filled in, well before track('lead') fires.
  • It runs on secure (HTTPS) pages.
lead-form.js
// as the visitor fills in the form
form.email.addEventListener('change', (e) =>
  Torii.identify({ email: e.target.value }));
form.phone.addEventListener('change', (e) =>
  Torii.identify({ phone: e.target.value }));

// later, when the lead is submitted
form.addEventListener('submit', () =>
  Torii.track('lead', { value: 120 }));

data-linker and Torii.decorate(url)

Carries the visitor, their ad click and their campaign tags from one of your domains to another, so a sale on the second site is tied to the original ad.

  • Links to listed domains get _tv=<visitor>.<session>, plus any UTMs and click IDs the link lacks. Values already on the link are kept.
  • Install the same pixel on the other domain. It adopts the visitor and session, then removes _tv from the address bar.
  • *.example.com covers subdomains.
  • For navigation done in script, decorate() returns the URL with the hand-off attached when it points at a linked domain, and any other URL unchanged.
lander.example
<script async
  src="https://app.toriidata.com/torii.js?id=YOUR_PIXEL_ID"
  data-linker="shop.example.com,*.myshopify.com"></script>

// navigation in script: carry the visitor across
location.href = Torii.decorate('https://shop.example.com/cart');

Find out which ads your leads and orders come from.

We'll put the tag on one site with you, yours or a client's, then go through what it records together, down to the campaign and ad click behind each lead and order.