diff --git a/README.md b/README.md index 699b798..74f2fab 100644 --- a/README.md +++ b/README.md @@ -4,31 +4,25 @@ 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. @@ -36,14 +30,14 @@ 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 ``` diff --git a/resources/js/package.js b/resources/js/package.js new file mode 100644 index 0000000..85bc2b6 --- /dev/null +++ b/resources/js/package.js @@ -0,0 +1 @@ +import './gtm' \ No newline at end of file