Sarbacane becomes Positive User
Positive User Custom Script
x

Custom Script

One script. Every feature. Add a lightweight snippet to your website's source code and unlock the full power of Positive User: visitor tracking, live chat, contact identification, and event-based automation. No plugin, no CMS dependency, no developer required beyond access to the HTML.

One Snippet to Power Your Entire Platform

Works on Any Website

Works on Any Website

No CMS plugin? No problem. The Positive User script integrates with any website: static HTML, custom-built applications, headless architectures, or platforms without a dedicated plugin. Paste the snippet before your closing </body> tag and tracking starts immediately.

From Anonymous Visitor to Known Contact

From Anonymous Visitor to Known Contact

The moment the script loads, Positive User assigns a unique key to each visitor and starts tracking pageviews, device, browser, and location, all anonymously. When you're ready to identify users, pass attributes like email, name, or phone number through the script. Every piece of pre-identification activity is then merged into the identified contact profile.

Pass Any Data You Need

Pass Any Data You Need

The window.civchat object accepts standard attributes (name, email, phone number, status, score) and company data (company name, ID, revenue), all in a single code block. Use static values, GTM variables, or dynamic JavaScript to feed the object. Whatever you push, lands instantly on the contact profile.

Get ready fast

Three simple steps to get started

1

Copy Your Script

In your Positive User app, go to Settings > Setup & Integrations > Basic Integration. Copy the script. It already contains your unique API key and app domain.

2

Add It to Your Website

Paste the script before the closing </body> tag in your website's source code. Alternatively, deploy it via Google Tag Manager with a trigger set to fire on all pages.

3

Verify Tracking

Open your website, then check the Contacts section in Positive User. New anonymous visitor records should appear within seconds. For a technical check, open your browser console, type civchat, and confirm the object is defined. Tracking is live.

Setting up the Custom Script integration with Positive User
FAQ

Frequently Asked Questions

Do I need coding skills to integrate the script?
Minimal. You need access to your website's HTML source code (or Google Tag Manager) and you paste a pre-built snippet. The script is copied directly from your Positive User settings, no editing required. If you're comfortable opening a website file or pasting a tag into GTM, you're set.

What's the difference between the basic and advanced script?
The basic script contains only your API key. It enables anonymous visitor tracking, pageview recording, and the chat widget. The advanced script adds a window.civchat object where you can pass user attributes (email, name, phone) and company data, so visitors land as identified contacts in Positive User from the start.

Will the script slow down my website?
No. The script loads asynchronously and is lightweight. It doesn't block page rendering or interfere with your site's performance.

Can I use this with Google Tag Manager instead of editing my source code?
Yes. You can deploy the Positive User script as a custom HTML tag in GTM. Set the trigger to fire on all pages. This is the recommended approach if your team already manages other tags through GTM, or if you don't have direct access to the website's source code.

How does anonymous visitor tracking work?
When the script loads, it generates a unique user_key and stores a cookie in the visitor's browser. Every pageview is recorded and associated with this key. The visitor appears as an anonymous record in Positive User until they identify themselves (chat interaction, form submission, or attributes passed via the advanced script).

What data formats are required for attributes?
Dates must follow ISO 8601 format (e.g., 2017-07-25T14:14:08.612Z). Phone numbers must use E.164 format (e.g., +44754123434). Other attributes accept strings, numbers, or booleans depending on the field type defined in your Positive User app.

Can I pass company data alongside user data?
Yes. The window.civchat object accepts a nested company object with attributes like name, company_id, and revenue. This creates or updates both the contact profile and the associated company record in Positive User in a single call, with the link between them maintained automatically.

What if I don't want the chat widget to appear?
You can still use the script purely for tracking and data collection. Go to Settings > Chat Widget Settings > Widget Visibility, and set the widget state to "Hidden." The script continues to run silently in the background.

How do I verify the script is working?
Two methods. First, check the Contacts section in your Positive User app: new anonymous records should appear after visiting your site. Second, open your browser's developer console on your website and type civchat. If the object is defined, the script is loaded and tracking is active.

Can I track custom events with this script?
The script itself handles visitor identification and attribute passing. To send custom events (purchases, form submissions, button clicks), you'll need to add event-tracking calls separately, either through the Positive User JavaScript API or via Google Tag Manager triggers. Our team can help you map out the right approach for your use case.