Google Analytics

Time to read: 14 minutes


Introduction

With this external PepperShop module, you can analyze the shop via Google Analytics and optimize the shop for your customers.

Login to Google Analytics

To sign up for Google Analytics, you need a Google Account first. Sign up now.

Figure 1: Google Analytics dashboard

On this page, select Create Account to access the Google sign-in form. If you already have a Google Account, log in here with your credentials. Otherwise, click “Create Account” first to create an account.

Now you should be able to login with your Google Account. After logging in, you will be prompted to create a new account (now for Google Analytics). Fill out this form with the desired data (make sure you enter the correct domain name).

Figure 2: Create a Google Analytics account

Once you have created the account, you should see on the next page which tracking ID you have been assigned. You need the tracking ID to configure the module (Web-Property-ID).

Figure 3: Tracking ID of your account

Module configuration

Figure 4: Google Analytics module configuration dialog

In the Google Analytics module administration there are the following settings:

General configuration

  • Activation: Should the module be active?
  • Google Tag Manager integration: Should the Google Tag Manager be used instead of the direct Google Analytics connection?
  • Web Property ID: This is your Google identification number. The value can be found in the Google Analytics account. If the default value remains, the module is inactive.
  • Container ID: Displayed only when Google Tag Manager integration is enabled! Appears in the Tag Manager account.
  • Enable e-commerce tracking: Should the order completion be transmitted? (Recommended)
  • Transfer Statistics Events: Should statistics events be transmitted?

Google Analytics integration

  • Anonymize IP addresses: Should the IP addresses be transmitted anonymously? (This is mandatory in Germany due to GDPR!)
  • Upgrade to Universal Analytics: for more information, see the following Help

Configuration for experienced users

The active Google Analytics code that is displayed on the website. This code can be customized in the following HTML template, but this is not mandatory:

{shopdir}/shop/language/html_templates/analytics.tpl.html

Customization in Google Analytics code

If you have good knowledge of Google Analytics code, you can extend and personalize the code, but be careful with the variables.

The representation is based on an HTML template, which works with variables (for more information, see PepperShop online help text ‘Using the PepperShop template system’). The relevant HTML file the following:

{shopdir}/shop/language/html_templates/analytics.tpl.html

You can open this file with an editor and make appropriate adjustments there:

<!-- BEGIN analytics_main -->
<script type="text/javascript">
var _gaq = _gaq | [];
_gaq.push(['_setAccount', '{ua}']);
{anonymizeIp}
{track_page_view}
{e_commerce_tracking}
(function() {
  var ga = document.createElement('script');
  ga.type = 'text/javascript';
  ga.async = true;ga.src = ('https:' == document.location.protocol ? "https://ssl":
http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- END analytics_main -->

An explanation of how to use the PepperShop template system can be found in the shop administration in the main menu by clicking on the link ‘Help Topics’ in the bottom left corner and looking at the help text ‘Using the PepperShop template system’.

Info: The template file uses UNIX line breaks. Use a suitable editor - for Windows e.g. Notepad++.

Privacy notice

As soon as the module is active, two variables are filled in the imprint, which contain legal information regarding Google Analytics. This text can be adjusted in the translation file for each language 1:

{shopdir}/shop/language/{language code}/html_templates/localetext.inc.php?

Use of Google Analytics

Below is some general information about using Google Analytics. This information is independent of the PepperShop Google Analytics module.

Embed Google AdWords campaigns in Analytics

This operation requires administrator access to the Google AdWords account and the Google Analytics account.

The link is quite simple. A detailed description can be found here: https://support.google.com/analytics/answer/1033961?hl=en

Define and view funnel display for ordering process as targets

In order to analyze the bounce rate in detail during the ordering process, e.g. to determine whether the payment method portfolio needs to be improved, you can proceed as follows. Here we create a so-called conversion target with several steps:

Figure 5: Analytics Screenshot, targets

  1. Log in as user with administration rights at Google Analytics
  2. Select the data view to be edited in the Administration tab (only necessary if several pages / shops are managed)
  3. Create a new target action under target action.
    Figure 6: Target description for the order process
  4. Start with a custom input.
  5. Assign a name to the target.
  6. Select the type. If you want to work with the page views from our list, choose Target.
    Figure 7: Target definition for the order process
  7. Define the destination: in this case order completion.
  8. If necessary, you can assign a value to the target.
  9. If you also want to record the steps before the finish, we recommend the funnel.
    Figure 8: Target definition for the newsletter registration process

Another example:

The aim here is to activate the newsletter.

The steps of opening the newsletter form and ordering the newsletter are recorded here. However, only after the confirmation of the sent mail the goal is reached.

For other targets, for example, use the terms from the Pageview column of the Overview of Available Statistics Events: Statistics Events

View funnel visualization

Now that the target has been defined, you should wait for at least one day. The target can then be assessed for the first time with figures:

You must be logged into Google Analytics and have chosen a profile. On the left side of the start page in the menu you select the point Goals at the bottom of Conversions and click on Funnel-Visualization. If several goals have been defined, the goal ‘Finish’ must now be selected.

Now you can see the funnel visualization of the ordering process.

For this we look at where many visitors bounce:

Figure 9: Example display of a funnel analysis

Interpretation of the results

  • In the shopping cart: Here the additional costs are communicated for the first time: Do I have unattractive positions such as minimum quantity surcharges? Expensive shipping costs? An incorrect default setting for shipping country and / or shipping method?

  • In the cash register: Do I ask too much (unnecessary) in the address input mask? Do I not offer enough payment methods? ..or not the right payment methods? ..or too few payment methods?

  • Order overview / AGB / order completion page: Many visitors do not want to pay: Is my web presence not trustworthy enough (design, external evaluations, usability, customer guidance, info texts on the site, …) or are my general terms and conditions / revocation instruction texts not good? Are customers uncertain if they are talking about customs costs not included in foreign deliveries?

Further evaluations

Where can I find what?

Info about reports: Adjustments made to the reports, such as adding a segment, are applied to all other reports.

Dashboard
The most frequently used data can be inserted here as a widget so that they can be found immediately the next time you visit. To do this, you can create links to the dashboard (“Add to dashboard”) in the reports.

Links
The shortcuts work similar to the dashboard, but you can also fix configuration settings like filters, segments or dimensions.

Radar events
Observe changes of e.g. page views, bounce rates, etc. over days/weeks/months. You can also define your own rules for when a notification should be created.

real time
Analysis of the currently active users. It can be seen how many users are currently on which page, where they came from and whether, for example, a target has been completed.

Target group
Demographic characteristics + interests can be activated, but some data are missing because not every user can be assigned these data. You can also filter according to geographical characteristics, behavior, type of device and browser. There is also an overview of the user flow through the pages accessed.

Acquisition
Comprehensive possibilities to determine the origin of the users, be it through a direct link, campaigns or Google. You can work with the data from any AdWords account and, for example, view the times when sales are strong.

behavior
To find out on which pages your visitors move in which order, you can see under the category Behavior.

Conversion
Here you evaluate your defined conversion goals such as order completion, number of sales per product, downloads or newsletter entries.

Analyze

At the top right of the window, the time period of the data to be displayed is specified. The duration can be freely selected and compared with a previous period or last year. Interesting questions:

  • How many visitors have visited a particular landing page?
    Behavior > Web site content > All pages > Enter page in search box

  • Where did they come from and which page was called next?
    Select desired page > switch from Explorer to navigation overview

  • What’s the percentage of smartphone users?
    Target group > Mobile > Overview > Column “Meetings

  • Where do my customers leave the shop?
    Behavior > Website content > Exit pages

  • How are the streams of visitors distributed in the shop?
    Behavior > Behavioral flow

  • How many target conversions were achieved with a particular campaign?
    Create a link for your campaign on https://support.google.com/analytics/answer/1033867 so you can see what your newsletter or ad has done in Google Analytics. Instead of a link to your page, use this link in your ad, which can also point specifically to a product or category. You will find the evaluation under Acquisition > Campaigns.

  • Which categories are most / least viewed? (also works for articles)
    Behavior > Website content > All pages > Search term: {/shop/} > Filter out categories manually

or set a conversion target /{CategoryReference} for the category (recommended only for a few categories)

  • Which products are bought the most / the least? (also works for categories)
    Configuration:Manage > Data View > E-Commerce Settings > Enable E-Commerce
    Evaluation:Conversion > E-Commerce > Product performance

Statistics Events

Some activities in the shop are not page views, but corresponding activities can be recorded with statistics events.

Overview of available statistics Events: http://www.peppershop.com/peppershop_files/peppershop_statistik_events_uebersicht.pdf

Detailed view of all statistics events: http://www.peppershop.com/peppershop_files/phpeppershop_statistik_events_details.pdf

Instructions for creating a new statistics event: http://www.peppershop.com/peppershop_files/anleitung_neue_statistik_events_erfassen.pdf

Using Google Tag Manager

Starting with version 6, the Google Analytics module offers an alternative interface that replaces the previous direct interface with an interface to Google Tag Manager. For the use of the new interface, existing knowledge of GoogleTag Manager is absolutely necessary, as well as recommending it. An introduction to GoogleTag Manager can be found in the Tag Manager Help.

Tags

Below we would like to discuss an example configuration consisting of several Google Tag Manager Tags that transfer the following data from the shop to a Google Analytics account:

  • Viewed Products, Categories
  • product detail calls
  • page views
  • events

The following prerequisites must be fulfilled:

  • That an existing Container is available at Google Tag manager
  • The Google Tag Manager integration is activated in the module configuration of the shop.
  • And that the Container ID of the desired container is stored in the module configuration.

Ecommerce

Transfers various information in the datalayer that is already prepared for the use of advanced e-commerce reports in Google Analytics.

  • Tag type: Universal Analytics
  • Tracking ID: {{gaID}} (Your Google Analytics ID / or matching variable)
  • Track Type: page view
  • Ecommerce:
    • Enable Enhanced Ecommerce Features: select
    • Use data layer: select

Trigger
Label Trigger type Event name Fires on Description
Category Custom Event pps_category Event equals pps_category Triggers the display of a category and contains information on all products viewed.
Product Custom Event pps_product Event equals pps_product Triggers when displaying a product detail page.
Purchase Custom Event pps_purchase Event equals pps_purchase Triggers the completion of a purchase and contains information on all ordered products.
Checkout Custom Event pps_checkout Event equals pps_checkout Triggers the display of the individual pages of the purchase process
Search Result Custom Event pps_searchResult Event equals pps_searchResult Triggers when displaying search results
Virtual Page View Custom Event pps_virtualPageView Event equals pps_virtualPageView Triggers the display of pages with unwieldy URLs.
add to cart Custom Event pps_addToCart Event equals pps_addToCart Triggers when an item is placed in the shopping cart.

Events

Transfers the statistics events as you already know them from the direct Google Analytics connection.

  • Tag type: Universal Analytics
  • Tracking ID: {{gaID}} (Your Google Analytics ID / or matching variable)
  • Track type: event
  • Category: {{category}}
  • Action: {{action}}
  • Label: {{label}}
  • Value: {{value}}
  • Non-Interaction Hit: true

Trigger
Label Trigger type Event name Fires on Description
Event Custom Event pps_event Event equals pps_event Triggers when statistics events were triggered.
Variables
Label Variable type Data Layer Variable Name Description
category Data Layer Variable category This is a default from Google Analytics. Read more under: Events
action Data Layer Variable action
label Data Layer Variable label (Label)
value Data Layer Variable value (value)

Virtual Page Views

Transmits virtual page views. These are page views where normal URLs would not necessarily say anything about the call type. The names of the virtual page views are more comprehensible.

  • Tag type: Universal Analytics
  • Tracking ID: {{gaID}} (Your Google Analytics ID / or matching variable)
  • Track type: Page View
  • Fields to Set:
    • Name: location, Value: {{pageUrl}}

Trigger
Label Trigger type Event name Fires on Description
Virtual Page View Custom Event pps_virtualPageView Event equals pps_virtualPageView Triggers a virtual page call. See above for more info.
Variables
Label Variable type Data Layer Variable Name Description
pageUrl Data Layer Variable pageUrl The virtual page url of the call.

Figure 10: Example analysis: Lego and Playmobil

At this point we would like to introduce a tool. With Google Trends you can find out very interesting numbers about search terms. For example, you can analyze the development of a trend based on Google search queries. These can then be limited in a time period and also geographically. Very exciting are the search queries related to the search term, which show you trends that you can’t identify yourself. This is useful for your own newsletter campaigns, your own advertising or even for shopping.

Module installation

System requirements

To be able to use the Google Analytics module, at least one PepperShop v.3.0 Professional or Enterprise is required and a Google account with analytics enabled (available free of charge from Google).

Copy and upload files

The Google Analytics module consists of several files and two directories that you have to copy into your installed PepperShop. First unpack the supplied ZIP or TAR.GZ archive. The following files are included, here with their target directories:

{shopdir}/shop/Admin/module/google_analytics
{shopdir}/shop/module/google_analytics/
{shopdir}/shop/analytics.php
{shopdir}/shop/language/html_templates/analytics.tpl.html

The files can easily be uploaded to the web server via FTP2 or SCP. The placeholder {shopdir} stands for the shop directory on the web server, where you can find the file index.php together with README.txt. When using PHP on UNIX/Linux as server module, the file analytics.tpl.html must still be assigned the file access right 666 so that the web server has write access to it.

Preparations

Before the Google Analytics module existed, Google Analytics was manually integrated into the shop if required. The tracking codes were integrated into the header via the shop administration.

The corresponding Google Analytics code should be removed from the shop before activating this module. However, the UA code given by Google should be noted, since you have to specify it again when configuring this module.

Depending on the previous use, the existing code may be present in the following places:

  • In the language files (Shop administration → Shop settings → Languages)
  • As Hearest Thanks Text (E-Commerce Tracking)
  • As header variables (Analytics JS scriptlet with UA no.)
  • In HTML templates (mostly in the HTML template main page.tpl.html)
  • As programming in PHP files (only in shop subdirectory, very rare!)

Occurrences of analytics code can be localized by searching for the expression gaq.

Google Conversion Tracking with this module

If there are already Google Conversions in the shop, they will be left where they are. If new conversions should be added, they can be added to the ‘Thank you’ text for the respective language under ‘Languages’ in the shop administration to complete the order.

In case of special requirements (e.g. conversions for article thumbnails or logins), the corresponding Google code must be stored in the respective HTML templates.

Activation

After copying the files you can go to the shop administration and change there to the menu ‘Module’. On the left side, at the not yet installed modules, you can now see the Google Analytics module listed.

Figure 11: The Google Analytics module is listed (displayed modules may vary)

Now you have to select the Google Analytics module and click on the Install button. If the installation routine runs without problems, this will be communicated on the following page. The module is now installed. We now click on the button Back to module administration and there Back to module administration We now see the button for the administration of the Google Analytics module.

Figure 12: Installed Modules

The installation of the Google Analytics module is now complete. In order for the module to be used, it must now be adapted to the specific configuration of the shop operator, see the next chapter Module Configuration, below.


  1. As an alternative to making adjustments directly in the file, you can also switch to the Languages section in the shop administration and click on the link ‘Adapt all translated texts’ and scroll to the points GA_DATENSCHUTZ_TITLE and GA_DATENSCHUTZ.
  2. E.g. with the free program FileZilla Client: http://filezilla-project.org/
🌶️
🔥
🌶️