Google Analytics

Skip to end of metadata
Go to start of metadata

Integration of the tracking code

If you just want pimcore to integrate the tracking code into all html pages delivered by pimcore only the "Track-ID" is reqired by the configuration, there is no need to enter your Google Account.

About the data visualization

Pimcore offers an advanced integration of Google Analytics.
This module is fully included in pimcore and uses directly the Google Analytics Data Export API without any data proxy or something else between.
Your Google credentials are only stored locally in your pimcore installation for the direct use with the Data Export API.

The 2 Modes

Pimcore offers 2 different modes to display data out of Google Analytics.

The "Simple Mode" ist only for tracking pages, the path is used to map between the pimcore document and the Google Analytics data.
The "Advanced Mode" offers you the possibility to track every element you like, for example teasers (document), news (object), the mapping is ID-based. Please see the following guide to setup advanced tracking.

Setup the advanced tracking

Configure Google Analytics to work with the advanced mode

  1. Create a new profile for an existing domain and link it with the existing profile (Name it for example: pimcore.org internal)
  2. Go to the Filtermanager
  3. Create 2 filters, one to exclude the real traffic (new created profile) and one to include only the real traffic (existing profile)

 

Configuration in Pimcore

Go to the "Reports & Marketing" settings and select the new created internal profile instead of the existing profile from google analytics.
Then check the option "Advanced Mode".

Note: When enabling the advanced mode, only the pageviews which are tracked by Pimcore_Google_Analytics::trackElement(); will be displayed. No normal pageviews shown in Google Analytics will be displayed anymore, so you don't have the histroy anymore in the statistics shown in pimcore.

Example to track every document element (pages & snippets)

<?php

class Website_Controller_Action extends Pimcore_Controller_Action_Frontend {
    
    public function init () {

        parent::init();
        
        
        if($this->document instanceof Document) {
            Pimcore_Google_Analytics::trackElement($this->document);
        }
    }
}

?>

Example to track objects

<?php


$object = Object_News::getById(7895);
Pimcore_Google_Analytics::trackElement($object);


?>
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.