Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add app.js, update readme #2

Merged
merged 2 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,40 @@ This Rapidez package provides 2 views with the GTM scripts, listens to events em

## Installation

```
```bash
composer require rapidez/gtm
```

Add to your `resources/js/app.js`

```
require('Vendor/rapidez/gtm/resources/js/gtm.js');
```

And add your GTM ID in the `.env`
```
```env
GTM_ID=
```

And finally add `@include('rapidez-gtm::head')` and `@include('rapidez-gtm::foot')` in the head and at the bottom of your layout template, most likely at: `resources/views/vendor/rapidez/layouts/app.blade.php`. If you haven't published the Rapidez views yet, you can publish them with:

```
```bash
php artisan vendor:publish --provider="Rapidez\Core\RapidezServiceProvider" --tag=views
```

## Multistore

Just add all stores in `config/rapidez-gtm.php` after you've published the config with:
```
```bash
php artisan vendor:publish --provider="Rapidez\GTM\GTMServiceProvider" --tag=config
```
Where the key of the `id` array is the store code.

## Views

If you need to change the views you can publish them with:
```
```bash
php artisan vendor:publish --provider="Rapidez\GTM\GTMServiceProvider" --tag=views
```

## Purchase tracking

This package doesn't send any purchase events as it's better to send those from the backend in case a visitor blocks Analytics with a browser extension, for example with [elgentos/magento2-serversideanalytics](https://github.com/elgentos/magento2-serversideanalytics). To make sure the user ids from Analytics match and the purchase is linked to the correct visitor we advice you to install this fork: [jbclaudio/magento2-serversideanalytics](https://github.com/jbclaudio/magento2-serversideanalytics) which includes a "AddGaUserId" GraphQL mutation so it's possible to push the id from Rapidez to Magento. When installed you can enable it in the `.env` with:
```
```env
GTM_ELGENTOS=true
```

Expand Down
1 change: 1 addition & 0 deletions resources/js/package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './gtm'