OneTrace.ru Help center

Connecting your website

The tracker is a small script on your website's pages. It counts page views, sends customer actions (product views, cart, orders, sign-ins), shows recommendation widgets, and subscribes visitors to Web Push. Everything you need to connect it is in Engagement → Website.

The section is open to all project members. Owner, Administrator, and Manager can change website domains and widgets. Owner and Administrator can create a website key.

Install the tracker

The Installation tab has three steps.

1. Code for every page

  1. In the Write key field, choose a key. If there are no keys, click Create a website key.
  2. Copy the code with the copy button.
  3. Paste it into the <head> of every page on your website, usually in the shared header template.

The code looks like this (the address and key are already filled in on the page):

<script>
!function(w,d,u){var c=w.cdp=w.cdp||[];if(c.version)return;['init','page','track','identify','alias','reset','setLanguage','widgets','renderRecommendations'].forEach(function(m){c[m]=c[m]||function(){c.push([m].concat([].slice.call(arguments)))}});var s=d.createElement('script');s.async=1;s.src=u;d.head.appendChild(s)}(window,document,'https://cdp.onetrace.ru/tracker/cdp.js');
cdp.init('cdp_wk_…', { host: 'https://cdp.onetrace.ru' });
cdp.page();
</script>

The script loads asynchronously and doesn't slow down your website. You can call cdp.track() right after the code: the calls wait for the tracker to load. The tracker gives each browser a persistent visitor ID (the cdp_aid cookie, valid for a year) and saves the visit's UTM tags.

The write key is visible in your page code, and that's fine: it can only send events. If keys in the list are unavailable, they were created before this section existed and can't be shown in full. Create a new website key or take the key from the code already on your website.

Installation tab: tracker code and installation check

2. Check

After installing, open any page of your website. Within a few seconds, a table appears in the Check block: Domain, Events in 7 days, and the time of the latest event. Until events arrive, the section shows Waiting for the first events. The check refreshes itself every 10 seconds while the section is open.

3. Website domains

To stop other websites from sending events on behalf of your project and pulling recommendations, list your website's domains:

  1. Enter a domain, for example shop.example.com, and click +. To add a domain from the check table, click Add to domains.
  2. Click Save.

A domain also allows its subdomains: shop.com lets www.shop.com through. While the list is empty, the key works on any website (No restriction). Requests from your server aren't affected by this restriction. You can list up to 20 domains.

Single-page apps (SPA and PWA)

In apps built with React, Vue, Angular and the like the page does not reload, so page views have to be sent by the app: call cdp.page() after every screen change, but not twice for the first load — the install code has already sent it. If the router hook also runs on the first load (afterEach in Vue Router, useEffect in React), remove cdp.page() from the install code instead — there is an example on the Installation tab.

// after every screen change, once the router has updated the address
cdp.page();

// a screen without its own address, or the address has not changed yet
cdp.page('Cart', { path: '/cart', title: 'Cart' });

If a screen has no address of its own (a modal, a checkout step, a PWA without addresses) or the router changes the address later, pass the page explicitly: path or url (relative is fine) and the title. That page goes into the page view and into the context of the following events — for example, an add to cart is tied to the cart screen — until the next cdp.page() call. The tracker treats the previous screen as the referrer of the second and later screens and keeps the visit's UTM tags until the tab is closed.

Customer sign-in and sign-out

After a sign-in or sign-up, call cdp.identify() with the user's ID in your system, and the visit history will be linked to the customer's profile:

cdp.identify('user-42', { email: 'anna@example.com' });

Send a User ID only for signed-in users, and don't use shared values like 0 or guest: profiles with the same User ID will be merged. When the user signs out, call cdp.reset() so the next person at that computer gets a new ID.

The Customer identification table on the Product events tab shows which identifiers each channel needs and how they get into the profile: email for email campaigns, phone in international format for SMS, WhatsApp and Viber by number, and for Telegram and Viber bots — linking the chat via a link created by your server. Pass everything you know about the customer: the more identifiers, the more channels are available.

Customer language

The tracker sends the browser language, and it is saved to the customer profile (the language trait) until the language is set explicitly. Journeys and campaigns use this language to pick the language version of a template. The project languages are shown in the Customer language block on the Installation tab.

If the site has a language switcher, report the visitor's choice — it is remembered and saved to the profile:

cdp.setLanguage('de');

Another language source is set at initialization: language: 'page' — the lang attribute of <html>, a language code — one language for the whole site, false — do not send the language. A language known in your system can be passed as a trait: cdp.identify('user-42', { language: 'de' }).

Product events

The Product events tab shows ready-made calls for five actions: Product view, Add to cart, Order, Wishlist, and Sign-in and sign-up. Event names and the product ID property (product_id by default) come from the Recommendations settings. If no events are selected there, you'll see a warning, and the examples will use the default names: product_viewed, add_to_cart, order_completed.

An order example, with all products sent in the products array:

cdp.track('order_completed', {
  order_id: 'A-1001',
  amount: 9980,
  products: [{ product_id: 'SKU-1', quantity: 2, price: 4990 }],
});

Wishlist is optional: the add_to_wishlist and remove_from_wishlist events are used by journeys that announce price drops and restocks of wishlisted products. Call cdp.addToWishlist('SKU-1') and cdp.removeFromWishlist('SKU-1'), or skip the code: give the button the data-cdp-wishlist="SKU-1" attribute (add) or data-cdp-wishlist-remove="SKU-1" (remove), and the tracker sends the event on click.

Each step has a status mark: how many events arrived in 7 days and when the latest one came, or No events in 7 days. This shows which calls aren't working yet. The product ID must match the ID in the product catalog.

Product events tab with marks for received events

Orders and sign-ups are more reliable when sent from your server. See Server integration.

Referral links

If referrals are turned on in the loyalty program, each member has a link to your website with the ?ref=CODE parameter. The tracker detects this parameter by itself: it saves the code for 30 days in the cdp_ref cookie and sends the referral_visited event once. The friend is counted when they sign up or sign in on the website. The store plugins pass the code from the cookie at sign-up; a custom website does it through the API.

Web Push

The Web Push tab shows whether the channel is connected and how many subscriptions there are. If there's no channel, create one with the Open integrations link; the keys are generated automatically (see Integrations and channels). Then:

  1. Service worker file. Create a cdp-sw.js file in the root of your website with a single line:
    importScripts('https://cdp.onetrace.ru/tracker/cdp-sw.js');
    
  2. Subscribe button. Add a button to your website that calls cdp.push.subscribe() on click. Browsers only ask for notification permission in response to a visitor action.

Notifications only work on websites with HTTPS. The subscription is linked to the visitor's profile.

Web Push tab: channel status and website code

CMS and Google Tag Manager

The CMS and GTM tab has step-by-step instructions for a custom website, Google Tag Manager, 1C-Bitrix, Tilda, WordPress and WooCommerce, and InSales: where to paste the installation code, events, and widgets.

For example, in Google Tag Manager, create a "Custom HTML" tag with the installation code and the "All Pages" trigger. Product events need separate tags that call cdp.track with triggers on dataLayer events (view_item, add_to_cart, purchase). After publishing the container, check on the Installation tab that events are arriving.

Connecting with an AI agent

If a developer builds your website with an AI agent (Claude Code, Codex, Cursor and others), give the agent a ready-made skill. On the AI agent tab, click Download SKILL.md. The file contains instructions for the agent in English with your project's data: the OneTrace.ru address, the selected write key, product event names, widgets and the Web Push status. With it, the agent adds the install code, product events, sign-in and sign-out, widgets and the notification subscription by itself.

  1. If there are several write keys, select the one you need.
  2. Download the file and put it into the website project: for Claude Code — .claude/skills/<skill name>/SKILL.md, for other agents that support Agent Skills — into their skills folder, for example .agents/skills/<skill name>/SKILL.md. The exact path is shown on the tab. You can also simply attach the file to your message to the agent.
  3. Give the agent a task — there is a sample text on the tab.

AI agent tab: a skill with the project data for an AI agent

Secret keys never go into the skill. If you change the events in the recommendation settings or add widgets, download the skill again.

Good to know

  • Search engine crawlers, messenger link previews, website monitoring services and automated browsers are not tracked: the tracker sends no events and sets no cookies for them, but still shows recommendation widgets. To track every visitor, add the option to the install code: cdp.init('…', { host: '…', ignoreBots: false }).
  • The tracker collects events and sends them in batches. If the network drops, events are stored in the browser and sent later.
  • All website events appear in real time in the Events section.
  • Recommendation widgets are set up on the Widgets tab. See Recommendation widgets on your website.