Go to content

Connect Google Analytics and Google Tag Manager to Johku

In Johku, you connect the storefront's visitor tracking to either Google Analytics (GA4) or Google Tag Manager by entering the ID under Settings → Storefront → Metadata and tracking. Use only one of them at a time: if a Tag Manager container ID is entered, Johku doesn't start GA4 tracking at all.

Before you start

  • Cookie consent management must be in use in your shop, because Google Analytics and Tag Manager set cookies for visitors. See Cookies and cookie consent on your Johku storefront.

  • You need a Google Analytics 4 property or a Google Tag Manager container in your Google account.

  • Choose which one you use. GA4 is enough for visitor and online store statistics. Tag Manager is suitable if you want to manage several tracking tags, for example the Meta (Facebook) pixel, or connect a cookie management service other than the ones Johku supports directly.

Connect Google Analytics (GA4)

  1. Copy the ID of your GA4 property from Google Analytics. It has the format G-XXXXXXXXXX.
  2. In Johku, open Settings → Storefront → Metadata and tracking.
  3. Paste the ID into the Google Analytics key field.
  4. Make sure that the Google Tag Manager field is empty.
  5. Save.

In addition to page loads, Johku sends the online store's events to Analytics, such as adding a product to the basket and purchases. The names and contents of the events follow Google's GA4 ecommerce model, which is described in Google's developer documentation (Ecommerce events, client_type=gtag).

Connect Google Tag Manager

  1. Copy your container's ID from Google Tag Manager. It has the format GTM-XXXXXXX.
  2. In Johku, open Settings → Storefront → Metadata and tracking.
  3. Paste the ID into the Google Tag Manager container ID field.
  4. Save.

When a container ID is entered, Johku doesn't use the Google Analytics key. If you want GA4 statistics with Tag Manager too, add the GA4 ID to Tag Manager as a tag of its own in the container.

Page views with Tag Manager

The Johku storefront is a single-page application: when a visitor moves from one page to another on the storefront, the browser doesn't reload the page. Tag Manager's Google tag sends a page view only when a page loads. Without an additional setting, Analytics therefore sees only the first page of each visit.

For every page view, including the first one, Johku adds the page_view event to the dataLayer. Choose one of these two ways, not both, so that page views are not counted twice:

  • In Google Analytics: open the data stream's Enhanced measurement settings and make sure that the advanced page view setting Page changes based on browser history events is on. No changes are needed in Tag Manager.

  • In Tag Manager: add a Google Analytics: GA4 Event tag whose event name is page_view, and trigger it with the Custom Event page_view. In the Google tag's Configuration settings, add the parameter send_page_view with the value false so that the first page is not counted twice. In that case, turn off the Analytics setting Page changes based on browser history events.

Online store events with Tag Manager

Johku adds events that follow the GA4 ecommerce model to the dataLayer: view_item_list, select_item, view_item, add_to_cart, remove_from_cart, view_cart, begin_checkout, add_shipping_info, add_payment_info and purchase. They go to Analytics only when the container has a tag for them.

One tag is enough for all of them: add a Google Analytics: GA4 Event tag, select the variable {{Event}} as its event name, and in the tag's advanced settings select Send Ecommerce data with Data Layer as the source. Trigger the tag with a Custom Event whose name matches the regular expression ^(view_item_list|select_item|view_item|add_to_cart|remove_from_cart|view_cart|begin_checkout|add_shipping_info|add_payment_info|purchase)$.

Result

The storefront's visitors start to show in the Google Analytics reports after the visitors have given cookie consent. It can take about a day for the data to accumulate in the reports.

If the data is not shown in Analytics

The reports show no visitors at all. Check that the ID is in the right field and in the right format: an Analytics ID starts with G- and a Tag Manager ID with GTM-. If both fields are filled in, Johku uses only Tag Manager, and the GA4 key is not read. Remove one of the IDs or add GA4 to Tag Manager.

With Tag Manager, only the first page of each visit is shown. Page changes inside the storefront need their own setting. See Page views with Tag Manager.

With Tag Manager, purchases and other online store events are not shown. Check that the container has a tag for the online store events and that it is not paused. See Online store events with Tag Manager.

Tracking worked before but stopped. Cookie consent management is no longer in use, for example because the Consent Studio subscription or the Cookiebot trial period has ended. Without working consent management, tracking doesn't start. Check the service's subscription and the Johku setting under Settings → Storefront → Cookie management.

The visitor numbers look smaller than they really are. Analytics counts only the visitors who accept tracking cookies. Some visitors refuse consent, so the figures are always a sample of the total traffic.

Good to know

Johku has no visitor tracking of its own, and you can't install your own tracking scripts directly on the storefront. Other tracking tools, such as the Meta pixel, are connected through Google Tag Manager.

The amounts in the online store events are numbers and include VAT, like the prices on the storefront. The purchase value (value) is the total price of the products: delivery costs are separately in the shipping field and VAT in the tax field. The discount code is in the coupon field, and the product's price is the discounted price. For each product, the affiliation field holds the ID of the shop that sells it, so on a marketplace you can break sales down by merchant.

For now, Johku doesn't send information about refunds to Analytics, so a refunded order stays in the Analytics sales figures.