Skip to the page

Developer GuideTracking

Sign-ups and purchases

Count accounts, subscriptions and payments with one venbit() call, and use app mode when people sign up on a separate address such as app.yoursite.com.


For software and shops, the win usually isn't a contact form. It's somebody making an account, starting to pay or completing an order, and only your code knows when that happens. Report it with one call:

JavaScript
venbit('signup', { name: 'Dana Whitfield', email: 'dana@example.com', plan: 'Free trial' });
venbit('subscribe', { value: 49, currency: 'USD', plan: 'Pro', email: 'dana@example.com', id: 'sub_1042' });
venbit('purchase', { value: 129.5, currency: 'USD', email: 'dana@example.com', id: 'order_8841' });
CallUse it forWhere to call it
venbit('signup', props)A new account or a free trialWhere the account is made, once it's saved
venbit('subscribe', props)A paid plan startingWhere the payment for the plan goes through
venbit('purchase', props)A one-off paymentOn the order confirmation page

Set it up

  1. In the dashboard open Settings, then Goals, and add Sign-ups, Subscriptions or Purchases. Without the goal, the call won't count as a win.
  2. On the goal's row choose How to set it up. You'll see the lines below filled in with your details, and Email these to your developer sends them on.
  3. Add the call to your code, after the tracker line. You'll find that line under Settings, then Tracking, with your site's key in place of KEY.
HTML
<script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY" data-site="KEY"></script>
<script>
  window.venbit = window.venbit || function () { (venbit.q = venbit.q || []).push(arguments); };
  venbit('signup', { name: 'Dana Whitfield', email: 'dana@example.com', plan: 'Free trial' });
</script>

That second line is a stub. It holds the call until the tracker has loaded; leave it out and an inline script on a welcome page runs before the deferred tracker, so the call fails. Since the call goes out at once, it's safe to redirect straight after it.

Properties

All of these are optional, and venbit('signup') on its own is a valid call.

PropertyTypeWhat it is for
namestringWho signed up or paid. With it, the Inbox and the iPhone app say who it was.
emailstringTheir email. Also used to tell repeats apart when there's no id.
planstringThe plan or product name, such as Pro or Free trial.
valuenumberThe amount in the currency given: 49 or 49.99. Must be zero or more. Gets rounded to two decimals. A string such as "49" is ignored.
currencystringThe currency code for value, such as USD.
idstring or numberYour own id for the order, subscription or account. It tells two payments apart and stops one being counted twice.

Venbit treats name and email like anything else a visitor types into a form. If the site is set to keep nothing visitors type, or the tracker tag carries data-capture="off", they're dropped and the event arrives without a name. Only the properties in this table are kept, and anything else you pass is ignored.

How repeats are handled

Welcome pages get reloaded. React effects run twice. Either way, the tracker counts the same event once:

You passWhat counts as a repeat
idThe same call type with the same id, in the same browser, within 24 hours.
email but no idThe same call type with the same email, in the same browser, within 24 hours.
NeitherThe same call type again within two seconds on the same page.

If you pass both, id decides. For this check the browser remembers a short fingerprint of the id or email, never the email itself.

Worked example: an order confirmation page

HTML
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Order confirmed</title>
    <script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY" data-site="KEY"></script>
  </head>
  <body>
    <h1>Thanks, your order is confirmed</h1>
    <p>Order <span id="order-id">order_8841</span></p>

    <script>
      window.venbit = window.venbit || function () { (venbit.q = venbit.q || []).push(arguments); };

      const order = { id: 'order_8841', total: 129.5, currency: 'USD', email: 'dana@example.com' };
      venbit('purchase', {
        id: order.id,
        value: order.total,
        currency: order.currency,
        email: order.email,
      });
    </script>
  </body>
</html>

On a real page your server would render the order object. Reload it and the order won't count again, since the id hasn't changed.

To have a coding agent add the calls to your product:

Report sign-ups and payments to Venbit in this codebase. Where an account is saved, call venbit('signup', { name, email, plan }). Where a plan payment succeeds, venbit('subscribe', { value, currency, plan, email, id }). On the order confirmation, venbit('purchase', { value, currency, email, id }) and always pass the order id. value must be a number, not a string. Before the first call add: window.venbit = window.venbit || function () { (venbit.q = venbit.q || []).push(arguments); }; For TypeScript, declare both interface Window { venbit } and a global var venbit.

When people sign up on another address

Plenty of products keep the marketing site on one host and the product on another, say harborroofing.example and app.harborroofing.example. For a sign-up in the app to be credited to the ad or page that brought the person to the website, you need to set up two things.

How a visit on harborroofing.example carries over to a sign-up on app.harborroofing.example

1. Tell Venbit where people sign up

Under Settings, then Goals, open How to set it up on the sign-up, subscription or purchase goal. Type the address into the box under "People sign up on another address", for example app.harborroofing.example, and press Save.

After that, a click on a link from your website to that address carries the visit along. The link gains a vb_x parameter as it's clicked, and the tracker on the other side removes it from the address bar as soon as the page loads.

When your code navigates by itself, with no <a href>, ask the tracker for the address to use:

JavaScript
const target = 'https://app.harborroofing.example/signup';
window.location.href = window.venbit('link', target) || target;

2. Use the app mode line on the app's pages

Once you've saved an address, the same screen shows a second line for the pages there. Use it on those pages instead of the usual one:

HTML
<script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY&mode=app" data-site="KEY" data-mode="app"></script>

In app mode the tracker only sends the sign-ups and payments your code reports. Page views, clicks, forms and time on page aren't recorded, and the Site Agent doesn't show. So people who use your product every day aren't counted as visits to your website, and your marketing numbers stay about marketing.

data-mode="app" and &mode=app say the same thing twice on purpose. Some tools strip attributes from script tags, and the copy in the address survives them.

Then call venbit('signup', ...) in the app as usual:

HTML
<script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY&mode=app" data-site="KEY" data-mode="app"></script>
<script>
  window.venbit = window.venbit || function () { (venbit.q = venbit.q || []).push(arguments); };
  venbit('signup', { name: 'Dana Whitfield', email: 'dana@example.com', plan: 'Free trial' });
</script>

Which line goes where

PagesLineCounted
Marketing site (harborroofing.example)The usual tracker lineEverything: visits, clicks, forms, plus any venbit() calls
The product (app.harborroofing.example)The app mode lineOnly signup, subscribe and purchase calls
A shop where browsing and checkout share one siteThe usual tracker line on every pageEverything. App mode isn't needed.

A subdomain of your registered domain works with no further setup. If the app lives on a different domain altogether, the screen asks you to add it to the website's addresses under Settings, then Tracking. Skip that and calls from it get dropped.

App mode follows the usual line's rules about where it runs. It stays silent on localhost, inside iframes and in opted-out browsers. See Install the tracker.

If your product has its own address, this prompt makes both changes:

Our product at [app.yoursite.com] is separate from our marketing site. On the product's pages, replace the Venbit tracker with the app mode line: <script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY&mode=app" data-site="KEY" data-mode="app"></script>, KEY = [your site key]. On the marketing site, wherever code sends people to the product without an <a href>, use window.location.href = window.venbit('link', target) || target.

Where the events show up

Each call completes the matching goal (Sign-ups, Subscriptions or Purchases) and counts as a win for the visit. Pass a name or email and the Inbox says who it was. The event also becomes a step in the visitor's trail, so the ad or page that brought the person stays attached to it.

These calls are never treated as form sends. If your site counts its contact form as a lead, it won't suddenly start counting every sign-up as one too.

Common questions

How do I track purchases with Venbit?

Add the Purchases goal under Settings, then Goals, and call venbit('purchase', { value, currency, email, id }) on the order confirmation page. Always pass id so that two orders from the same email on the same day are counted separately.

Will a reloaded thank-you page count a sale twice in Venbit?

No. With an id, the same call type with the same id in the same browser within 24 hours counts once. With only an email, the email does that job. With neither, a repeat within two seconds on the same page counts once.

How do I track sign-ups that happen on app.mysite.com?

Save the app's address under Settings, then Goals, in How to set it up on the sign-up goal, so links from your website carry the visit across. Then put the app mode line (data-mode="app") on the app's pages and call venbit('signup') there as usual.

Do Venbit sign-ups count as form leads?

No. signup, subscribe and purchase are never treated as form sends. Each completes its own goal (Sign-ups, Subscriptions or Purchases) and counts as a win for the visit.

Last updated . Something wrong or missing on this page? Tell us from Settings, then Support.