PHPackages                             dvsa/mot-google-analytics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dvsa/mot-google-analytics

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dvsa/mot-google-analytics
=========================

A Laminas module for easy integration of Google Analytics and Google Tag Manager

v3.0.0(1y ago)06.7k↓37.5%1proprietaryPHPPHP ^8.2

Since Jun 13Pushed 1y ago6 watchersCompare

[ Source](https://github.com/dvsa/mot-google-analytics)[ Packagist](https://packagist.org/packages/dvsa/mot-google-analytics)[ RSS](/packages/dvsa-mot-google-analytics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (17)Versions (8)Used By (0)

mot-google-analytics
====================

[](#mot-google-analytics)

A Laminas module for easy integration of Google Analytics and Google Tag Manager.

Google Tag Manager and Data Layer
---------------------------------

[](#google-tag-manager-and-data-layer)

> **Google Tag Manager** is a tag management system created by Google to manage JavaScript and HTML tags used for tracking and analytics on websites (variants of e-marketing tags, sometimes referred to as tracking pixels or web beacons).

*-- from [https://en.wikipedia.org/wiki/Google\_Tag\_Manager](https://en.wikipedia.org/wiki/Google_Tag_Manager)*

> A **data layer** is an object that contains all of the information that you want to pass to Google Tag Manager. Information such as events or variables can be passed to Google Tag Manager via the data layer, and triggers can be set up in Google Tag Manager based on the values of variables (e.g., fire a remarketing tag when `purchase_total > $100`) or based on the specific events. Variable values can also be passed through to other tags (e.g., pass `purchase_total` into the value field of a tag).

*-- from *

To set up a data layer, a snippet of code like the following must be added to the head of the page (or elsewhere above the container snippet):

```

  dataLayer = [];

```

The above snippet is an empty object that can be populated with information to pass to Google Tag Manager. You can see how to add properties to the Data Layer object in the *Usage* section.

```

  dataLayer = [{
    'userId': '5a713869ade8c3665c7e88c01e81a3f220cfde7d',
    'event': 'removed-defect',
    'journey': 'RFRs',
    'title': 'Test result entry - the defect has been removed'
}];

```

Requirements
------------

[](#requirements)

- [PHP 8](https://secure.php.net/downloads.php)
- [Composer](https://getcomposer.org/)

Installation
------------

[](#installation)

Install the package via Composer:

```
$ composer require dvsa/mot-google-analytics
```

Then enable the `GoogleAnalyticsModule` module by adding it to `application.config.php`.

```
