Download the PHP package rapidez/gtm without Composer
On this page you can find all versions of the php package rapidez/gtm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package gtm
Short Description Rapidez GTM
License GPL-3.0
Homepage https://rapidez.io
Informations about the package gtm
Rapidez GTM
This Rapidez package provides 2 views with the GTM scripts, listens to events emitted by the Rapidez Core and adds ecommerce data to the datalayer. Currently for Universal Analytics Enhanced Ecommerce but you can use this with Analytics 4 by using a GTM Template.
Installation
And add your GTM ID in the .env
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:
Multistore
Just add all stores in config/rapidez/gtm.php
after you've published the config with:
Where the key of the id
array is the store code.
Views
If you need to change the views you can publish them with:
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 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:
view_item_list event
To track the view_item_list
event, you can use the v-item-list
directive on your product list, for example:
You can also track it only on intersection by adding the .intersection
modifier. This defaults to 50% intersection, but can be overridden: v-item-list.intersection="{ intersection: 80, ... }"
Enhanced Conversions
To track Enhanced Conversions, we supply a seperate file you can run when you have captured the relevant user info you want to push.
for example after subscribing to the newsletter, or entering their details in the checkout. Here's an example of how you could implement it
Temporarily disable
If you'd like to test for example the Lighthouse scores without GTM you can disable it by added ?gtm=false
to the url
Partytown
Scripts like GTM have a massive negative impact on performance and pagespeed, to remedy this scripts like Partytown have been made. Which allows you to keep your analytics but reclaim some of the performance.
Note that partytown is technically not production ready and still in beta.
Installation
- Execute
yarn add @builder.io/partytown
- Configure Vite to copy the partytown files (however instead of dist it should go in public)
- Make sure symfony/psr-http-message-bridge is installed, if it is not:
composer require symfony/psr-http-message-bridge
- Enable partytown for GTM by adding
GTM_PARTYTOWN_ENABLE=true
to your .env - Add
/public/~partytown
to your .gitignore
Additional domains and CORS
Not all domains support partytown due to their CORS settings (https://partytown.builder.io/proxying-requests)
This package comes with a proxy for these domains which by default is only set up for GTM (see: config/rapidez/gtm.php)
If you notice more domains giving CORS errors you can add them to the config or in a comma seperated list in your .env under GTM_PARTYTOWN_DOMAIN_WHITELIST
.
Custom config
The partytown configuration is available in window.partytown
so you can change the configuration by updating the configuration within <script></script>
tags.
Running partytown but not for GTM
If you want to run partytown but not for GTM that's possible too by configuring GTM_PARTYTOWN_ENABLE=false
and manually including the partytown view in the head.
License
GNU General Public License v3. Please see License File for more information.
All versions of gtm with dependencies
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/view Version ^9.0|^10.0|^11.0
rapidez/core Version ^2.0