In this article we will explain how you can add the Google Tag manager code to your website and ensure that it works correctly with Google Analytics GA4
You will need to add some code to your website on 2 locations:
Location 1
1. Open your shop in ShopFactory software and go to your ShopFactory Central page
2. Click "Site Analytics / SEO" button
3. Click “Website Analytics”
4. Locate the "Google Analytics Code" box and then paste your code as shown in screenshot:
Your tag manager code should look like this, all you need to is make sure that GTM-XXXXXXX is replaced with your actual tag manager ID (login to https://tagmanager.google.com/ to find your tag manager ID)
<!-- Google Tag Manager -->
<script>(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-XXXXXXX ');</script>
<!-- End Google Tag Manager -->
Location 2
1. Open your shop in ShopFactory software and go to your ShopFactory Central page
2. Click "My Store” button
3. Click “Custom Website Contents” (if a ShopFactory alert pops up, click Close)
4. Click on the + sign to add a new content block (see image below)
5. Click on the Pencil to edit it (see image above) (if a ShopFactory alert pops up, click Close)
6. The “Add Custom Contents“ wizard will appear. Now locate the content block that was just created in step 4, it is the bottom one in the list (if you already have other pieces of content, otherwise it will be the only one listed there) and the name starts with HC. Select it and click the pencil to edit it, see the image below
7. Rename the block to “Google Tag Manager” in the identification name area, and past the script below in the main contents window AND make sure to tick the box in front of “Field contains Javascript code”. See image below for the correct settings
The code should look like this, all you need to is make sure that GTM-XXXXXXX is replaced with your actual tag manager ID:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
8. Click OK, Click OK again, and click Finish. Now save your shop and Publish it to the Internet.