Integration Guide
This guide explains how to integrate the Mintegral Pixel on custom websites, including fully self-built websites, Shopify stores running in Headless Mode, or sites built with other CMS platforms.
There are two integration methods:
- Using Google Tag Manager (GTM) to manage scripts and tracking codes
- Directly embedding the Mintegral Pixel into your custom online store
Both methods allow tracking of page views, user interactions, and conversion events.
In this guide, we will go over Method #1 and integrate through GTM.
Integration via Google Tag Manager (GTM)
Use case: Your website uses GTM to manage scripts and tracking codes.
Integration Steps
Step 1: Loading the Mintegral Pixel SDK
-
In GTM, navigate to Tags → New → Custom HTML Tag.
-
Paste the following code:
<script>
(function (w, d) {
var u = "https://cdn-static.mintegral.com/sdk/pixel.js";
if (w.mintegralPixel) return;
var s = (w.mintegralPixel = function () {
s.performOperation
? s.performOperation.apply(s, arguments)
: s.operationQueue.push(arguments);
});
s.operationQueue = [];
var f = d.getElementsByTagName("script")[0],
e = d.createElement("script");
e.async = !0;
e.src = u;
f.parentNode.insertBefore(e, f);
})(window, document);
mintegralPixel("init", {
setupType: 1 // 1 - self-built website
});
</script>
-
Set the trigger to All Pages and save the tag.
⚠️ Note: Load the SDK only once per page to avoid duplicate events.
Step 2: Reporting Mintegral Official Events
Mintegral Event Data Structure
All events reported to Mintegral must follow this standard data structure:
Name | Type | Description |
type | string |
The name of event. See Standard Events and Objectsfor available events. |
data | object |
The data of event. See Standard Events and Objectsfor data to send. |
Copy and paste the following code and prepare the Data Layer on the Website.
dataLayer.push({
"event": "purchaseEvent",
"mtg_type": "purchase",
"mtg_data": {
"currency": "USD",
"value": 179.98,
"items": [
{
"item_variant_id": "sku123-blue-42",
"item_id": "sku123",
"item_name": "Air Sneakers",
"price": 89.99,
"quantity": 2,
"image_url": "https://cdn.example.com/images/sku123.jpg"
}
]
}
});
⚠️ Note:
mtg_type
andmtg_data
must comply with Mintegral specifications.
event
is only used for GTM triggers and does not affect SDK reporting.
GTM Configuration
-
Create Data Layer Variables:
DLV - MTG Type
→ mtg_type
DLV - MTG Data
→ mtg_data
-
Create a Custom Event Trigger:
Event name: e.g., purchaseEvent
-
Create a Custom HTML Tag:
Copy and paste the following code, assign the trigger and publish the configuration.
<script>
mintegralPixel("track", {
"type": "{{DLV - MTG Type}}",
"data": {{DLV - MTG Data}}
});
</script>