Skip to main content
All guides

Add website tracking

Add one line of code to your website so Envoi can see which pages your contacts visit.

Who can do this: Workspace owners, admins and developers. You may want your web developer for step 5 and step 6.

Before you start

  • Page views need only the install code. To link visitors to people who are already contacts, and so start automations from what they do on your site, your site must sign each envoi.identify call on its server (step 6). An identify without a signature links nobody who is already a contact, and their events start nothing.

Steps

  1. Step 1: Connect the Tracking Snippet

    Go to Integrations, find Tracking Snippet, and click Connect. In the window that opens, click Connect again.

    Open Integrations
  2. Step 2: Copy the install code

    You land on the snippet page. Under "Copy this into your site", click Copy Code beside "Install code".

  3. Step 3: Paste it into your website's header

    Paste the code into the <head> section of every page on your site. Most website builders have a setting for this, often called "header code", "custom code" or "code injection". Publish your site.

  4. Step 4: Check that it works

    Open any page of your site in a new tab, then go back to the snippet page. Under "Check that it's working", Envoi shows "Receiving events" as soon as the first page view arrives.

  5. Step 5: Link visitors to contacts

    Page views are recorded as soon as the code is live. To connect a visitor to a contact, your site calls envoi.identify with their email address and its signature (step 6) when they sign up or log in. Their earlier page views are then added to that contact. The snippet page shows the exact code under "Optional: who visitors are and what they do".

  6. Step 6: Verify who visitors are

    Anyone can see your site ID, so Envoi only links a visitor to a contact who already exists when your site proves it. Under "Verify who visitors are", click Generate Identity Secret and copy the secret: Envoi shows it only once. Your web developer stores it on your server and uses it to sign each email address, with the code shown there for Node.js, Python or PHP, then passes the signature to envoi.identify. Visitors who arrive from a link in an Envoi email are verified automatically, and so is a visitor whose Envoi form submission adds them as a new contact. Without a signature, a new address is still saved as a pending contact, but nothing is added to an existing contact and none of their automations start. If that happens, the snippet page says how many identify calls could not be linked, and your browser's console shows why.

Good to know

  • To check that a website event starts an automation, use a contact who is subscribed (not pending), sign the identify, and make sure they are not already in that automation: an event starts the same automation for one contact at most once a day.
  • The snippet sets a cookie on your own website that lasts about a year, so it can recognise returning visitors. You are responsible for telling your visitors about it, for example in your cookie notice or privacy policy.