Skip to content
Contlo by QuestionPro
Browse documentation

Install web tracking

The Contlo tracking snippet is one script tag. Once it is on your pages, Contlo can recognize returning visitors, record the pages and products they view, show your forms and web push prompts, and accept the identify and event calls you make from your own code. That activity is what your segments and automations use to turn visitors into first orders and repeat purchases.

Settings → Organization → Connect your custom storeOne script tagWorks through Google Tag ManagerShopify and WooCommerce: automatic

Do you need to install it yourself?

Your storeWhat to do
ShopifyNothing. The snippet is added when you connect the store. See Shopify.
WooCommerceNothing. The Contlo plugin adds it. See WooCommerce.
Custom site or any other platformInstall the snippet yourself, as described on this page.

The snippet uses your Public API Key. Public keys are safe to expose in page source. Never put a private API key in front-end code.

Get your snippet

  1. Open the account menu in the top bar and choose Settings.
  2. In Organization, find the Connect your custom store card and click Show snippet code. The card appears only for accounts that are set up as a custom store.
  3. On the Unique snippet code page, click Copy.

The snippet already contains your public key. It looks like this:

HTML
<script type='text/javascript' async='' src='https://marketing.contlo.com/js/contlo_messaging_v3.js?v=3&shop_id=YOUR_PUBLIC_API_KEY'></script>

Install on a custom site

Paste the snippet in the <head> of every page you want Contlo to track. Most sites do this once, in the shared layout or header template. The script loads asynchronously, so it does not block the page.

Through Google Tag Manager

You can publish the same snippet as a Custom HTML tag in Google Tag Manager, firing on all pages. Contlo's install check understands this setup: if it does not find the snippet in your page HTML, it looks inside the Google Tag Manager containers that the page loads (up to three).

In a JavaScript app, with npm

If you prefer to load the script from your application code, the contlo-web-sdk package does it for you. It checks your key and site URL, then injects the same script tag into the page.

npm i contlo-web-sdk

Verify the installation

  1. Publish the change to your live site.
  2. Go back to the Unique snippet code page in Contlo.
  3. Under Enter your URL to verify the connection., type your site address in Store URL (the https:// is already filled in) and click Verify.
  4. When the check passes, click Connect now.
MessageWhat it means
Snippet is installed on URL …Contlo found your snippet in the page HTML.
Snippet is installed on URL … via Google Tag ManagerContlo found your snippet inside a Google Tag Manager container on the page.
Snippet is not installed on URL …The page loaded, but no snippet with your public key was found. Check that the change is published, that the key in the snippet is yours, and that the URL you entered is a page that includes the snippet.
Invalid URL, please enter a valid one!Contlo could not load the address. Check for typos and make sure the page is publicly reachable without a login.

You can also check from the browser. Open your site, open the developer console and run the line below. Both values should be object.

Browser console
typeof window.contlo, typeof window.contloWebSDK

What the snippet does automatically

BehaviorDetails
Recognizes visitorsEach browser gets an anonymous visitor ID. The visitor becomes a known contact when they submit a Contlo form, arrive through a link that carries their Contlo contact ID, or when your code identifies them. See Track events and identify visitors.
Page viewsFor recognized visitors, page loads are recorded as Viewed Page (view_page). The same page viewed again by the same contact within an hour is not recorded twice.
Product viewsFor recognized visitors, a page whose URL contains /products/ followed by a product handle from your catalog is recorded as Viewed Product (view_product_page), with the product, its collections, price and any UTM parameters on the URL.
Visit historyFirst visit time, last visit time and number of visits are kept in the browser and used for form targeting.
UTM parametersutm_source, utm_medium and utm_campaign from the landing URL are remembered for one day and used for form targeting.
Cart contentsOn storefronts that expose the standard Shopify cart endpoints (/cart.js, /cart/add, /cart/update, /cart/change), the cart is synced to Contlo whenever it changes.
Forms, web push and chatThe snippet displays the popups, embedded forms, web push opt-in prompt and chat widget you have switched on in Contlo. See Forms and Push settings.

Hosts to allow

If your site uses a Content Security Policy or a firewall allowlist, allow these hosts.

HostUsed for
marketing.contlo.comThe script itself, page views, cart sync and visitor recognition.
events.contlo.comIdentify and event calls made through window.contloWebSDK.
form-ext.contlo.comLoading and displaying your forms.
callback-service.contlo.comThe chat widget, if you use it.
cdnjs.cloudflare.comA small encryption library the script loads.

Troubleshooting

SymptomWhat to check
Show snippet code is missingThe card is shown only for custom stores. Shopify and WooCommerce accounts get the snippet automatically. If you run a custom site and do not see it, write to hello@contlo.com.
Verification fails but the snippet is on the pageThe check reads the page from Contlo's servers. Pages behind a login, a password screen or a bot filter cannot be read. Verify against a public page. The key in the snippet must match your public key exactly.
window.contlo is undefinedThe script did not load. Look for a blocked request to marketing.contlo.com in the network tab, usually caused by an ad blocker or a Content Security Policy.
No page views for a test visitorPage views are recorded only after the visitor is recognized. Identify yourself first, then reload the page.
Product views are missingThe URL must contain /products/ followed by the handle of a product that exists in your Contlo catalog. A repeat view of the same product by the same contact within four hours is not recorded again.
Event calls return 403 with Enter valid urlCalls through window.contloWebSDK are accepted only from sites where the snippet has loaded. Make sure the snippet runs on the same origin before you send events.

Related guides

Can't find something? Email us