When to use this method:
Use Google Tag Manager in Shopify to forward data to Mintegral.
Steps:
-
Select Settings.
-
Select Customer events.
-
Click the Add custom pixel button.
-
Enter "Mintegral Pixel" as the Pixel name, then click Add pixel.
-
Copy and paste the following Shopify Code into the code field, then click Save.
Shopify Code
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-WB6Z5S3T'); (async ()=>{ //save event params to localstorage var url = new URL(window.location.href); var campaign = url.searchParams.get('utm_mtg_campaign_uuid'); var clickid = url.searchParams.get('utm_mtg_click_id'); var ls = await browser.localStorage.getItem('_mtg') if (campaign && clickid) { ls = JSON.stringify({"d":{"_default":{"u":campaign,"c":clickid,"t":parseInt(Date.now()/1000)}}}) browser.localStorage.setItem('_mtg', ls); console.log('mtg_write_ls', ls) } dataLayer.push({'mtg_token': ls }); })() analytics.subscribe('all_events',async e=>{ // //get localstorage var ls = await browser.localStorage.getItem('_mtg'); dataLayer.push({ 'event': e.name, // event name 'mtg_token':ls, 'shopify': e, }); });
-
Click Connect. This will display a dialog box “Connect Mintegral Pixel.”
-
Click Connect.
-
Ensure the Pixel Status shows Connected.
-
(Optional) Add manual event reporting:
Manual Event Reporting
⚠️ Tip: Skip this step if you do not need to manually report events.
If you're using GTM integration from another platform, ensure event values are passed to the
shopify
variable by copying and pasting the following Event Reporting Code.
Event Reporting Code
# shopify example dataLayer.push({ event: "page_loaded", shopify: { test: "test" }, });