<commit_before># Google Tag Manager plugin for Sylius 

[![License](https://img.shields.io/packagist/l/stefandoorn/google-tag-manager-plugin.svg)](https://packagist.org/packages/stefandoorn/google-tag-manager-plugin) [![Version](https://img.shields.io/packagist/v/stefandoorn/google-tag-manager-plugin.svg)](https://packagist.org/packages/stefandoorn/google-tag-manager-plugin) [![Build status on Linux](https://img.shields.io/travis/stefandoorn/google-tag-manager-plugin/master.svg)](http://travis-ci.org/stefandoorn/google-tag-manager-plugin) [![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/stefandoorn/google-tag-manager-plugin.svg)](https://scrutinizer-ci.com/g/stefandoorn/google-tag-manager-plugin/) [![Code Coverage](https://scrutinizer-ci.com/g/stefandoorn/google-tag-manager-plugin/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/stefandoorn/google-tag-manager-plugin/?branch=master)

Google Tag Manager plugin for Sylius eCommerce Platform

## Installation

### 1. Composer

`composer require stefandoorn/google-tag-manager-plugin`

### 2. Follow installation instructions of required sub bundle

https://github.com/xyNNN/GoogleTagManagerBundle

### 3. Load bundle

Add to the bundle list in `app/AppKernel.php`:

```php
new GtmPlugin\GtmPlugin(),
```

### 4. Adjust configurations

Required output to your HTML (head, body & footer) are done through events. Make sure the following 'sonata_block_render_events' are present in your views:

* `sylius.shop.layout.javascripts`
* `sylius.shop.layout.before_head`
* `sylius.shop.layout.before_body`

And configure the features you would like to use/not. Find a base configuration reference by running:

```
bin/console config:dump-reference GtmPlugin
```

### 5. Install assets

```
bin/console assets:install 
bin/console sylius:install:assets
bin/console sylius:theme:assets:install
```

## Features

* `environment`: Send Symfony/Sylius environment to GTM
* `route`: Send Symfony/Sylius route to GTM
* `context`: Send Sylius context information to GTM (currency, locale, channel)

## Usage

### Register events from JS
 
```javascript
    var event = new GaEvent('category');
    event.register(action, label, value);
```
<commit_msg>Update template events in README<commit_after># Google Tag Manager plugin for Sylius 

[![License](https://img.shields.io/packagist/l/stefandoorn/google-tag-manager-plugin.svg)](https://packagist.org/packages/stefandoorn/google-tag-manager-plugin) [![Version](https://img.shields.io/packagist/v/stefandoorn/google-tag-manager-plugin.svg)](https://packagist.org/packages/stefandoorn/google-tag-manager-plugin) [![Build status on Linux](https://img.shields.io/travis/stefandoorn/google-tag-manager-plugin/master.svg)](http://travis-ci.org/stefandoorn/google-tag-manager-plugin) [![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/stefandoorn/google-tag-manager-plugin.svg)](https://scrutinizer-ci.com/g/stefandoorn/google-tag-manager-plugin/) [![Code Coverage](https://scrutinizer-ci.com/g/stefandoorn/google-tag-manager-plugin/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/stefandoorn/google-tag-manager-plugin/?branch=master)

Google Tag Manager plugin for Sylius eCommerce Platform

## Installation

### 1. Composer

`composer require stefandoorn/google-tag-manager-plugin`

### 2. Follow installation instructions of required sub bundle

https://github.com/xyNNN/GoogleTagManagerBundle

### 3. Load bundle

Add to the bundle list in `app/AppKernel.php`:

```php
new GtmPlugin\GtmPlugin(),
```

### 4. Adjust configurations

Required output to your HTML (head, body & footer) are done through events. Make sure the following 'sonata_block_render_events' are present in your views:

* `sylius.shop.layout.javascripts`
* `sylius.shop.layout.head`
* `sylius.shop.layout.before_body`
* `sylius.shop.layout.after_body`

And configure the features you would like to use/not. Find a base configuration reference by running:

```
bin/console config:dump-reference GtmPlugin
```

### 5. Install assets

```
bin/console assets:install 
bin/console sylius:install:assets
bin/console sylius:theme:assets:install
```

## Features

* `environment`: Send Symfony/Sylius environment to GTM
* `route`: Send Symfony/Sylius route to GTM
* `context`: Send Sylius context information to GTM (currency, locale, channel)

## Usage

### Register events from JS
 
```javascript
    var event = new GaEvent('category');
    event.register(action, label, value);
```

Make sure also to listen for this specific event in GTM.

{'fraction_non_alphanumeric': 0.14125659050966607, 'fraction_numerical': 0.0021968365553602814, 'mean_word_length': 5.314840499306519, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1283642', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1469, 'n_words': 308}