Google E-commerce is a Prestashop module for sending data to Google Analytics and Google Adwords via Google Tag Manager. It tracks:
- product impressions
- product clicks
- product detail impressions (trigger: product page view)
- promotion impressions
- promotion clicks
- cart actions
- checkout actions
- Adwords conversion (trigger: order confirmation page view)
- purchases (trigger: new order payment)
- partial refunds (trigger: new order slip)
- complete refund
3 tags, 2 triggers, and 3 variables must be created in Google Tag Manager (see Usage).
This module is currently used in production websites with Prestashop 1.6 and PHP 7+.
This module is best used with Composer managing your Prestashop project globally. This method follows best practices for managing external dependencies of a PHP project.
Create or edit composer.json
in the Prestashop root directory:
"repositories": [
{
"type": "git",
"url": "https://github.com/creativewave/ps-cwgecommerce"
},
{
"type": "git",
"url": "https://github.com/creativewave/ps-module-configuration"
}
],
"require": {
"creativewave/ps-cwmedia": "^1"
},
Then run composer update
.
Google provides general support and developper support for using Google Tag Manager and configuring tracking with Google Analytics/Adwords.
But in short words, using Google Tag Manager boils down to create/use:
- a container: an HTML
<script>
(injected by this module) with a function (IIFE) injecting tags - tags: third party (Google Analytics/Adwords) Javascript code
- triggers: conditions checked by the container to decide which tags to inject
- variables: dynamic data used by tags and/or triggers
Creating a Google Tag Manager container
- Log in to Google Tag Manager
- Create a new (Web) container
- Pick up container ID
- Save it in Prestashop > Modules > CWGEcommerce configuration
Tracking impressions, clicks, purchases and refunds (2 tags, 1 triggers)
Optional: a built in Google Analytics Settings (multi-)variable(s) may be created and used by the following tags, in order to ease changes on Google Analytics tracking settings.
- Create a new trigger
custom event
with a valueorderUpdate
(to track transactions and refunds) - Create a new tag
Universal Analytics
with aPage view
tracking type and built in triggerAll Pages
- Create a new tag
Universal Analytics
with aTransaction
tracking type and custom triggerorderUpdate
Tracking Google Adwords conversions (1 tag, 1 trigger, 3 variables)
3 variables should be created in order to feed Google Tag Manager with conversion data (order ID, value and currency) generated by this module in a data layer (Javascript object).
1 trigger should be created to ensure that an order (conversion) has happened. This trigger will correspond to a view of the order confirmation page.
Google Adwords should know which conversion happened by checking a conversion ID and label, available in Google Adwords after having created a new conversion action.
- Create a new variable
data layer
with a valuegoogle_conversion_order_id
- Create a new variable
data layer
with a valuegoogle_conversion_value
- Create a new variable
data layer
with a valuegoogle_conversion_currency
- Create a new trigger
custom event
with a valueorderConfirmation
- Create a new tag
Adwords Conversion Tracking
- Set conversion ID and label
- Set previously created variables as order ID, value and currency
Note: a Conversion Linker tag should also be created if your Google Analytics/Adwords accounts arn't associated, otherwise Safari will block conversion tracking.
- Feature: track more data