Integrating Google Tag Manager (GA4) with a Module

Integrating Google Tag Manager (GA4) with a Module

Overview

Omnyfy can provide a module to allow you to sync your Google Tag Manager Account with the marketplace through a module configuration. You will need the following:
  1. A Google account with access to the Google Tag Manager (preferably the Marketplace Owner / Company account as SEO or contractor accounts will need to have their Google Account signed in and the system can access any container). You will need to already have a Google Analytics set up already.
  2. Full admin access to the marketplace back end interface.
  3. A license to use the module (speak to our Omnyfy team about this, if not already provided)
See the configurations below. 

Create a new container in Google Tag Manager

You will need to create a new container for your account. This assumes you already have a Google Account / Tag Manager set up. For more information on setting up your Google Account, you can use this guide: Creating your Google Analytics Tracking Code
  1. Navigate to your Google Tag Manager Accounts page: https://tagmanager.google.com/#/home.
  2. Click on the 3 dots on the upper right of the account to open the menu and select Create Container.



  3. When the pop up appears, input the Container name (typically the URL) and ensure Web is selected as the target platform.



  4. The container will then be created, and a pop up will open to show you the 2 codes that will need to be used for configuring the module. The 2 rectangles on the upper right of the code windows is the copy function, which you can use to copy the entire code.


    You can choose to leave this window open, or copy this code into Notepad / Text Editor (ensure you separate it out in the document).

  5. In another tab/window, you will need to begin the module configuration.

Module Configuration

Accessing the configurations

Once you have the new container created, you can configure the module from the back end.
  1. In another tab/window (if you haven't already), open the marketplace admin URL and log in as an Administrator.
  2. Navigate to Stores > Settings > Configuration.



  3. From the configurations menu on the left, select Anowave > Google Tag Manager.


General Options
Here, you will only need to populate these 2 fields:
  1. Google Tag Manager Code (Head): Paste the first code of the head from Google Tag Manager (copied from above) here.
  2. Google Tag Manager Code (Body): Paste the second code for the body (copied from above) here.


  1. Enable: This field can be used to enable/disable the GTM code on the marketplace.
  2. License: This should be prepopulated already by Omnyfy if available - so you will not need to do anything here.
  3. Use GTM split snippet: This should be set to Yes (This splits up the code between Head and Body)

The rest of the fields are not required for this section. Save this first.



Once saved, scroll down to continue to the Google Tag Manager API settings.

Google Tag Manager API

This is where you will need the Google Account Login.

You will only need to action the following fields:
  1. Authentication: Sign in with the Google Tag Manager Account Holder here. Simply follow the steps to sign in and allow all access - this first step is required.
  2. Once signed in, Authentication will then change to create the tags.



  3. Ignore these for now - you will need to have your Container ID and Account ID (with full permissions) set first.
  4. Once selected, input the following fields:

    1. Measurement ID: This will need to be obtained through your Google Analytics account (not Tag Manager). Navigate to your Data Streams and and select the Data Stream.



    2. Measurement API Secret: From the same Data Stream interface, copy your Measurement API Secret. Follow the instructions to create an API Secret for this Data Stream.



    3. Account ID: This can be found in your Google Tag Manager account UI. Navigate to Admin > Account Settings.





  5. Select Save Config (from the top right).
  6. Once the configuration is saved, navigate back to Google Tag Manager API, and select the Container ID (of the new container you had created). The dropdown will sync with the available containers from this account.



  7. When your container is selected, scroll back to the Authentication screen and select these tickboxes:
    Create variables (Google Analytics 4)
    - Create triggers (Google Analytics 4)
    - Create tags (Google Analytics 4)
    - Create GA4 Configuration tag (since it's a fresh container)



  8. Select Save Config again. This time it will take longer to save, as the tags, triggers and variables are being created.

Enhanced Ecommerce Tracking Preferences

Here there are only 2 fields you need to configure.

Brand attribute: This should be mapped to the appropriate Product Attribute in the marketplace (typically named Brand).




Impression payload model: This should be set to after Pageview.



Verify the tags in Google Tag Manager

To verify that your account has been linked, in Google Tag Manager, navigate to the Tags menu for this container.



Before you created the tags, this section would be empty. When you chose the Container ID and created the GA4 tags, variables and triggers, these would be populated from the system. You can check the Triggers and Variables

Triggers:



Variables:



Ecommerce data may take some time to sync - sometimes lagging a couple of days. Standard page views will be instantaneous.

If you do not see any tags, please try select the options in the configuration again, and ensure the correct Container ID is selected (and all of the other fields such as Measurement ID, API Secret and Accound ID are correct). If it still does not provide you with any tags, you may need to check that the Google Account you are using has the correct permissions. Your Google Account that you sign in with MUST have the permissions to create tags.



Since the change of GA4, Google Analytics is now a 1st Party Cookie type rather than 3rd Party. When the Cookie type is 3rd Party, this may prevent the Google tag from loading properly, and omitting the src link from the code snippet. By default, GA4 is set as a 3rd Party Cookie Type from Omnyfy, so this will need to be reconfigured so that the tags will display correctly on the front end. This can be implemented before or after you have already configured the GA4 module - however this must be done for the code to display correctly.

1. As an admin, navigate in the back end to Customers > Cookie Consent > Cookies.


2. Scroll to the bottom until you find the _ga Cookie Name line item. Select Edit from the right side, if you can see that the Cookie Type is set to 3rd Party. You may skip this section entirely if it is already set to 1st Party.


3. Once on the Edit screen for this Cookie, scroll to the Cookie Type dropdown, and select 1st Party - then select Save.


You may need to clear your cache after. Note that this will not work until your GA4 module has been configured.

If you have any problems, please consult with your Omnyfy Support Team
    • Related Articles

    • Adding Basic Google Tag Manager / Analytics (GA4) to your Marketplace - Through the theme

      If you are not using a specialised module for Google Tag Manager (GTM), there are 2 spots you can add the specific GTM snippets. The Header HTML Scripts and in a content block that is across the website. If you are only using GA4 (Google Analytics ...
    • Creating your Google Analytics Tracking Code

      Google Analytics can help you to get additional tracking for your marketplace. This guide is designed to help you set up the linking of you Google Analytics account (Universal Analytics) to the Omnyfy platform, and does not cover SEO advice. Please ...
    • Setting up your Google Maps Account

      Google will be able to provide you with an API that will allow you to connect your Marketplace with a variety of Google Services, including Maps. Maps can be used for location verification for vendors when they create their locations. First you will ...
    • Adding the Maps APIs to your Google Account

      You can select Discover and Enable APIs from this Google Maps Platform screen, and access. Alternatively you can also select Enable APIS and Services to allow you to choose your Maps API from the APIs and Services Dashboard. You should already have ...
    • Configuring reCaptcha for the Marketplace

      Obtaining your Google reCaptcha keys To prevent your website from being overloaded by spambots or brute force entry, you can implement Google reCaptcha to minimise the impact of spam submissions and unauthorised entry. Get your Google reCaptcha from ...