Skip to content

PiwikPRO/analytics-template-for-gtm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Piwik PRO Analytics template for Google Tag Manager

Analyze the customer journey across websites and apps.

A documentation can be found in this Piwik PRO Help center article.

screenshot

Release Notes

The following changes and enhancements were intruduced since the initial template version:

Tag Configuration

  • "Site or app address": fixed input format (no https://) and enabled comma-separated lists for multiple hosts or domains
  • you can use a constant to populate the "Site or app address" field now (field type was changed)
  • New settings to support the following features:
    • "Use a custom tracker URL" enables the use of a custom endpoint like the Piwik PRO First Party Collector or server-side Google Tag Manager
    • "Override event URL" can be used to change the URL that gets sent with the current hit
    • "Set a custom document title" does the same for the title (can be used to pick a title from a dataLayer instead of the regular title in the browser)
    • Also, you can use "Override page referrer" to further control data that gets sent to Piwik PRO

Google Consent Mode & Privacy Settings

The "Use visitor cookies" option format was changed from checkbox to a drop-down including variables. This enables you to set this option depending on current consent.

The new option to "Don't collect visitor's device data" can be set in the same way, so the same tag can be used either with or without consent with dynamic privacy settings.

A similar mechanism applies to the new IP collection mode setting. You can choose to:

  • Collect visitors’ IP addresses
  • Mask IP addresses
  • Don’t collect visitors’ IP addresses

All 3 options can be controlled by the Google Consent Mode flag analytics_storage when "Follow Google Consent Mode" is selected from the dropdown.

Multiple "tracking types"

Additional to the standard init and page view, the new template supports the full set of Piwik PRO hits and events:

  • Basic tracking code
  • Basic tracking code (no page view event)
  • Goal conversion
  • Custom event
  • E-commerce events (-> Ecomerce Support)
  • Site search
  • Virtual page view
  • Content impression
  • Content interaction
  • Downloads and outlinks
  • Set custom dimension
  • Delete custom dimension

Depending on the selected "Tracking type" you can define hit specific parameters.

Custom dimension object

You can optionally define custom dimension objects when sending a Custom event, Goal conversion, Site search or Outlink or download. Those dimensions will only apply to the current hit. To define a custom dimension, add a new row to the table and enter the ID (index) of the dimension defined for your website and pick a variable or enter a constant string as dimension value.

E-commerce support

The template can send all types of Piwik PRO ecommerce events (ecommerce v2):

  • ProductDetailView
  • AddToCart
  • RemoveFromCart
  • CartUpdate
  • Order

You can add product data by providing an array (like ecommerce.items) and mapping object keys to the according Piwik PRO product structure or define all parameters of a single item manually.

Custom product dimensions

If you want to add dimensions to a product, add them either to the source array or for a single item (as result of a custom JavaScript variable) in the following format:

{
    1: "Dimension Value 1 here",
    2: "Another Dimension",
    5: "Yes"
}

Auto-detect e-commerce

When your website provides an ecommerce dataLayer in a format suitable for Google Analytics (Universal or GA4) and the event names match the GA4 ecommerce standard event scheme (like view_item, add_to_cart, remove_from_cart and purchase), you can use the option Auto detect from dataLayer event to populate all parameters without manual configuration.

If you still use a Universal Analytics dataLayer, the most recent ecommerce type containing a products key (purchase, remove, add or detail) will define the ecommerce event type if the current dataLayer event name does not match the GA4 standard names described above.