Google Tag Manager

Inhaltsverzeichnis

Introduction

With the Analytics module you can, among other things, connect Google Analytics to your PepperShop. Google Analytics provides valuable data about your shop visitors: where they come from, which products they are interested in and at which point they abandon a purchase. These insights help you to optimise your online shop on a solid, measurable basis rather than by gut feeling.

You can choose to connect PepperShop directly to Google Analytics (see Google Analytics 4 guide) or to send events to Google Analytics via Google Tag Manager. Google Tag Manager requires more setup because events, tags and triggers are created manually, but it offers more flexibility for additional tracking such as clicks on specific buttons or other non-e-commerce interactions. Google Tag Manager is particularly worthwhile if, in addition to e-commerce tracking, other specific user behaviour is to be measured.

You can also send events directly to Google Ads via Google Tag Manager instead of via Google Analytics.

This guide explains how to configure the Analytics module and how to create the most important triggers, tags and events.

Marketing services: we are happy to support you

Does the setup sound too complex, or would you simply prefer to use your time differently? Our marketing team can set up Google Analytics for you and also advise you on other areas of SEO and SEA. Please contact marketing@glarotech.ch.

Create a Google Tag Manager account

To connect PepperShop to Google Tag Manager, you need a Google Tag Manager account.

This Google guide explains how to create one.

Create a Google Analytics account

To view the data from Google Tag Manager, you need a Google Analytics account. We refer you to this guide from Google. Read how to:

  • Create an Analytics account
  • Create a new Google Analytics property
  • Add a data stream

The chapters “Set up data collection” and the following ones are not relevant for you.

Module configuration

How to configure the Analytics module:

  1. Log in to the PepperShop administration.
  2. Go to “Modules” → “Analytics”.
  3. In the “Google Analytics integration” section, fill in the following fields:
    • Activation: Tick the checkbox to activate the module.
    • Integration type: Select “Google Tag Manager”
    • Container ID: Enter your Google Analytics measurement ID. You can find out more in this Google guide.
    • E-commerce tracking: Tick the checkbox (recommended)
    • Activate enhanced e-commerce reports: Tick the checkbox (recommended)
    • Transmit statistics events: Tick the checkbox (recommended)
    • Advanced Consent Mode: Tick the checkbox (recommended)

Set up Google Tag Manager with Google Analytics 4

To use Google Tag Manager with Google Analytics, you need to complete the following steps.

Important: In the following, we use the English terms.

Create variables

Variables are placeholders for values or data that are needed when creating tags and triggers.

This is how you create a new variable:

  1. In the menu on the left of the Google Tag Manager homepage, click “Variables”.
  2. Under “User-Defined Variables” → “New”, create a new variable.
  3. Give your variable a name, for example “ga4_measurement_id”.
  4. Now select the variable type. (Which type is described for each variable in the text below.)
  5. You then usually need to fill in further details. (What to enter is described for each variable in the text below.)

Google Analytics tracking ID

The Google Analytics tracking ID is needed in many places in Google Tag Manager. It therefore makes sense to store it as a variable so that it only has to be maintained once and can easily be adjusted if it changes.

Variable name Variable Type Value
ga4_measurement_id Constant G-XXXXXXXXXX

Page Location

Page Location is used to capture the current URL of the page so that you know exactly on which page a page view or event takes place.

Variable name Variable Type Data Layer Variable Name Data Layer Version
DLV - page_location Data Layer Variable page_location Version 2

Configure the tag

The variables you created now need to be included in the tag.

  1. On your Google Tag Manager homepage, select “Tags” in the sidebar on the left.
  2. Click “New” → “Tag Configuration”.
  3. Select “Google Analytics”.
  4. Select “Google Tag”.
  5. Create the following tag:
    1. Tag Name: “GA4 - Config. + page view”
    2. Tag ID: Select the variable “ga4_measurement_id” here.
    3. Configuration Settings → Add parameter
      1. Configuration parameter: Enter “DLV - page_location”.
      2. Value: Enter {{DLV - page_location}}.
    4. Configuration Settings → Add parameter again
      1. Configuration parameter: Enter “send_page_view”.
      2. Value: Enter “true”.
  6. Finally, add a trigger to fire the tag.
  7. Select “All Pages” as the firing trigger.
  8. The tag can now be saved.

The tag then looks as follows:

Figure 1: Tag GA4-pageview

E-commerce tracking

With e-commerce tracking, Google Analytics can determine information about product revenue, the average order value, the number of transactions or the number of products sold.

Create a variable

  1. In the menu on the left of the Google Tag Manager homepage, click “Variables”.
  2. Under “User-Defined Variables” → “New”, create a new variable.
  3. Name your variable “DLV - ecommerce.checkout.actionField.step”.
  4. Select the data type “Data Layer Variable”.
  5. Enter the following data:
Variable name Data Layer Variable Name Variable Type Data Layer Version
DLV - ecommerce.checkout.actionField.step ecommerce.checkout.actionField.step Data Layer Variable Version 2

Create triggers

  1. On your Google Tag Manager homepage, select “Triggers” in the sidebar on the left.
  2. Create the following triggers by clicking “New”, then “Trigger Configuration”.
  3. Select “Custom Event”.
  4. Adjust the trigger name at the top left.
  5. Enter the event name (see the list below).
  6. Click “Save”.
  7. Repeat this for all triggers.
Trigger Name Trigger Type Event Name
CE - view_item_list Custom Event view_item_list
CE - pps_removeFromCart Custom Event pps_removeFromCart
CE - pps_purchase Custom Event pps_purchase
CE - pps_product Custom Event pps_product
CE - pps_category Custom Event pps_category
CE - pps_addToCart Custom Event pps_addToCart
*CE - pps_checkout - begin_checkout Custom Event pps_checkout

*For the “Trigger CE - pps_checkout - begin_checkout”, an additional setting is required:

  1. For “This trigger fires on”, select “Some Custom Events”.
  2. Enter the following:
    1. First field: Select “DLV - ecommerce.checkout.actionField.step”
    2. Second field: Select “equals”.
    3. Third field: Enter “2”.

Create tags

  1. On your Google Tag Manager homepage, select “Tags” in the sidebar on the left.
  2. Click “New” → “Tag Configuration”.
  3. Select “Google Analytics”.
  4. Select “Google Analytics: GA4 Event”.
  5. Fill in the following details:
    1. Adjust the tag name at the top left (see the table below).
    2. Measurement ID: Select the variable “ga4_measurement_id” here.
    3. Enter the event name (see the table below).
    4. Under “More Settings”, tick “Send Ecommerce data” and select “Data Layer” in the drop-down.
    5. Select the trigger (see the table below).
  6. Click “Save”.
  7. Repeat these steps until you have created all tags.
Tag Name Event Name Triggering
GA4 - PS - add_to_cart add_to_cart CE - pps_addToCart
GA4 - PS - begin_checkout begin_checkout CE - pps_checkout - begin_checkout
GA4 - PS - purchase purchase CE - pps_purchase
GA4 - PS - remove_from_cart remove_from_cart CE - pps_removeFromCart
GA4 - PS - view_item view_item CE - pps_product
GA4 - PS - view_item_list view_item_list CE - pps_category

Enhanced conversions (user_data)

If enhanced conversions is enabled in the Analytics module, the dataLayer push for the pps_purchase event also contains the user_data object (email and phone already hashed with SHA-256; optionally address).

Setup in Google Tag Manager:

  1. Create a Data Layer Variable, e.g. name DLV - user_data, Data Layer Variable Name: user_data.
  2. Create a User-Provided Data variable, type Code, data source: {{DLV - user_data}}.
  3. Open the GA4 event tag for the purchase (e.g. GA4 - PS - purchase). Under Event parameters, add the parameter user_data and set the value to the User-Provided Data variable. (Not under User Properties.)
  4. Verify the setup with GTM Preview and a test purchase.

Enhanced conversions must also be enabled in Google Analytics or Google Ads.

Publish the version

You can now test your configuration:

  1. In the workspace, click “Preview” at the top right.
  2. Enter the URL of your shop.
  3. A new window opens.
  4. Carry out a test purchase in your shop.
  5. Switch back to the old window (“Tag Assistant”).
  6. Click “Continue”.
  7. You should now see the events that were fired (for example “GA4 - PS - view_item”).
  8. Switch back to the Tag Manager page.
  9. Click “Submit” at the top right to publish your settings.
  10. Here you can still give your changes a version name and a description.
  11. Click “Publish”.

Further help

Do you have questions or need assistance? Do you have special requirements or desire a custom solution for your system? Our support team is happy to help. Support services are charged based on time and material at CHF 195.- / hour. Here is how to reach us:

Further useful pages

Was this page helpful?

🌶️
🔥
🌶️