Search...
Menu

Shopify Integration via Google Tag Manager

Label:pixel ,mintegral pixel ,shopify ,google tag manager ,GTM ,integrate pixel ,track events ,how to ,tutorial ,directions

When to use this method:

Use Google Tag Manager in Shopify to forward data to Mintegral.

Steps:

  1. Select Settings.
  2. Select Customer events.
  3. Click the Add custom pixel button.

  1. Enter "Mintegral Pixel" as the Pixel name, then click Add pixel.

  1. 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,
  });

});
  1. Click Connect. This will display a dialog box “Connect Mintegral Pixel.”

  1. Click Connect.

  1. Ensure the Pixel Status shows Connected.

  1. (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"
  },
});
Previous
Mintegral Pixel Integration
Next
Shopify Integration w/o Google Tag Manager
Last modified: 2025-07-29