Skip to main content

Tag integration

The Decentriq Tag (DqTag) is a lightweight JavaScript SDK for collecting witness (most often: page-view), identify, and profile events from your websites and webview-based mobile apps. We recommend integrating it via the tag manager that already deploys your other adtech scripts. The DqTag respects the TCF consent information provided by your TCF-compatible CMP — see TCF requirements.

For native mobile apps, integrate via the REST API instead.

The basic integration steps are:

  • Load the script from https://tag.decentriq.com/dqtag.min.js
  • Initialize the script with the clientId provided by Decentriq
  • Call logPageViewWitness() to log a page view
  • Call logIdentify({ "<identifier-name>": "<identifier-value>" }) to associate the page view with a known user identifier (e.g., a logged-in publisher user ID). The identifier names accepted for your DMP are configured during onboarding.

Two integration patterns are described below: via Google Tag Manager (or any other tag manager) and via direct code integration.

Example: integration via Google Tag Manager

note

Prerequisites: an existing GTM container, and a way to retrieve your user identifier (e.g., from a logged-in user SDK or your own session).

To integrate via Google Tag Manager:

  1. Log in to https://tagmanager.google.com and select the desired container.

  2. Go to Tags → New Tag.

    1. Tag Configuration → Custom HTML. Paste the snippet below, and replace <your-clientId-provided-by-Decentriq>, <identifier-name>, and <identifier-value> with your actual values.

      <script>
      // 1) Set up the command queue, executed once the DqTag is ready
      window.dqtag = window.dqtag || {};
      window.dqtag.cmd = window.dqtag.cmd || [];

      // 2) Queue up DqTag initialization (replace the placeholder value)
      window.dqtag.cmd.push(function (t) {
      t.initialize({ clientId: "<your-clientId-provided-by-Decentriq>" });
      });

      // 3) Queue up the page view event
      window.dqtag.cmd.push(function (t) {
      t.logPageViewWitness();
      });

      // 4) Queue up the identification event (once a user identifier is known)
      window.dqtag.cmd.push(function (t) {
      t.logIdentify({ "<identifier-name>": "<identifier-value>" });
      });

      // 5) Load the Decentriq Tag asynchronously
      (function (d, s, id) {
      var js, f = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id; js.async = true;
      js.src = "https://tag.decentriq.com/dqtag.min.js";
      f.parentNode.insertBefore(js, f);
      })(document, "script", "dqtag-js");
      </script>
    2. Give the tag a name, e.g. DqTag.

    3. Triggering → All Pages: Page View.

    4. Save.

  3. Publish your container.

Example: direct code integration

Add the script above between the <head> and </head> tags of your page.

Tracking page views in single-page applications

For traditional websites the snippet above is sufficient. For single-page applications, ensure that the snippet below also runs whenever the user navigates to a new route. Calling logIdentify more than once per session is fine but not required.

window.dqtag.cmd.push(function (t) {
t.logPageViewWitness();
});

Logging custom events

Beyond page views, you can log custom witness events with logWitness. Custom events let you capture publisher-specific actions such as video plays, newsletter signups, content interactions, or any other behavior you want to attribute to a user.

logWitness takes an event with two fields:

  • type — a string identifying the event type (e.g., "video_play", "newsletter_signup")
  • properties — an object of string-valued properties attached to the event
window.dqtag.cmd.push(function (t) {
t.logWitness({
type: "newsletter_signup",
properties: {
newsletter: "weekly_digest",
source: "homepage_banner"
}
});
});

Event types and their properties are publisher-defined and must be declared in the DMP configuration to be ingested.

Logging user profile traits

Use logProfile to attach profile traits to a user — long-lived attributes such as age bracket, gender, or subscription level. The DMP keeps the most recent value of each trait per user.

logProfile takes an object of string-valued traits (the trait names accepted for your DMP are configured during onboarding):

window.dqtag.cmd.push(function (t) {
t.logProfile({
age: "25-34",
gender: "F",
subscriber: "true"
});
});

Profile traits can be sent at any time after logIdentify — typically once per session, when the user logs in, or whenever the value changes.

REST API integration

tip

Use the REST API only for native mobile apps. For web platforms, use the Decentriq Tag described above.

The Decentriq DMP API is a RESTful service for collecting user events, identity mapping, and profile data. All events follow a standardized structure with consent management and a flexible event payload.

Base endpoint

https://dmp.decentriq.com/submit

Page view, identify, and profile

The POST requests below should be sent from the app whenever appropriate: page view and identify whenever the user navigates to a new content page; profile whenever a user logs in or a profile trait changes. Requests should only be sent if the TCF requirements are fulfilled.

danger

The same <user-id> must be used for every POST in a session for the same user, and no two distinct users may ever share the same <user-id>. Mixing or reusing IDs corrupts the user graph and silently breaks audience matching.

The placeholder values are:

  • <current-ts-in-ms> — current Unix timestamp in milliseconds
  • <user-id> — a user ID that's as stable as possible. All POST requests for the same user must use the same <user-id> and no two distinct users should share the same value (worst case, a per-session random value used across all POSTs)
  • <your-clientId-provided-by-Decentriq> — your client ID provided by Decentriq
  • <app-specific-string-selected-by-publisher> — a string identifying the app or surface
  • <tcf-consent-string> — TCF consent string per the TCFv2 CMP API (can be empty if <gdpr-applies> is false)
  • <gdpr-applies>gdprApplies per the TCFv2 CMP API
  • <url> — URL where the current page's content is reachable on the web (contact Decentriq if not applicable to your setup)
  • <identifier-name> / <identifier-value> — a user identifier (e.g., a logged-in publisher user ID)
  • <trait-name> / <trait-value> — a profile trait name and its value (e.g., age: "25-34", gender: "F")
POST https://dmp.decentriq.com/submit
Content-Type: application/json
Accept: application/json

{
"api": "witness/v1",
"timestamp": <current-ts-in-ms>,
"dqId": "<user-id>",
"clientId": "<your-clientId-provided-by-Decentriq>",
"site": "<app-specific-string-selected-by-publisher>",
"consent": {
"tcf": "<tcf-consent-string>",
"gdprApplies": "<gdpr-applies>",
"disableTcf": false
},
"event": {
"type": "page_view",
"properties": {
"url": "<url>"
}
}
}

POST https://dmp.decentriq.com/submit
Content-Type: application/json
Accept: application/json

{
"api": "identify/v1",
"timestamp": <current-ts-in-ms>,
"dqId": "<user-id>",
"clientId": "<your-clientId-provided-by-Decentriq>",
"site": "<app-specific-string-selected-by-publisher>",
"consent": {
"tcf": "<tcf-consent-string>",
"gdprApplies": "<gdpr-applies>",
"disableTcf": false
},
"event": {
"<identifier-name>": "<identifier-value>"
}
}

POST https://dmp.decentriq.com/submit
Content-Type: application/json
Accept: application/json

{
"api": "profile/v1",
"timestamp": <current-ts-in-ms>,
"dqId": "<user-id>",
"clientId": "<your-clientId-provided-by-Decentriq>",
"site": "<app-specific-string-selected-by-publisher>",
"consent": {
"tcf": "<tcf-consent-string>",
"gdprApplies": "<gdpr-applies>",
"disableTcf": false
},
"event": {
"<trait-name-1>": "<trait-value-1>",
"<trait-name-2>": "<trait-value-2>"
}
}

TCF requirements

To process data, Decentriq requires either:

  • TCF vendor consent for vendor ID 1449 (Decentriq) and purpose consents 1, 2, 3, 4, 7, or
  • The gdprApplies value must be false.