PHPackages                             rapidez/gtm - 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. rapidez/gtm

ActiveLibrary

rapidez/gtm
===========

Rapidez GTM

4.0.0(11mo ago)610.8k↓40%4GPL-3.0-or-laterJavaScriptPHP ^8.0

Since Jul 22Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/rapidez/gtm)[ Packagist](https://packagist.org/packages/rapidez/gtm)[ Docs](https://rapidez.io)[ RSS](/packages/rapidez-gtm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (43)Used By (0)

Rapidez 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.

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

[](#installation)

```
composer require rapidez/gtm
```

And add your GTM ID in the `.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:

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

Multistore
----------

[](#multistore)

Just add all stores in `config/rapidez/gtm.php` after you've published the config with:

```
php artisan vendor:publish --provider="Rapidez\GTM\GTMServiceProvider" --tag=config
```

Where the key of the `id` array is the store code.

Views
-----

[](#views)

If you need to change the views you can publish them with:

```
php artisan vendor:publish --provider="Rapidez\GTM\GTMServiceProvider" --tag=views
```

Purchase tracking
-----------------

[](#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) 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:

```
GTM_ELGENTOS=true
```

view\_item\_list event
----------------------

[](#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:

```
v-item-list="{
    items: items,
    item_list_id: 'recommended_products',
    item_list_name: 'Recommended products',
}"
```

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
--------------------

[](#enhanced-conversions)

To track [Enhanced Conversions](https://support.google.com/google-ads/answer/13262500), 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

```
import { setUserData } from 'Vendor/rapidez/gtm/resources/js/datalayer/google-ads.js';

window.app.$on('logged-in', () => {
    setUserData();
});

window.app.$on('checkout-credentials-saved', () => {
    setUserData();
});
```

Temporarily disable
-------------------

[](#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
---------

[](#partytown)

Scripts like GTM have a massive negative impact on performance and pagespeed, to remedy this scripts like [Partytown](https://partytown.builder.io/) 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

[](#installation-1)

- Execute `yarn add @builder.io/partytown`
- [Configure Vite to copy the partytown files](https://partytown.builder.io/copy-library-files#vite) (however instead of dist it should go in public)
- Make sure [symfony/psr-http-message-bridge](https://github.com/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

[](#additional-domains-and-cors)

Not all domains support partytown due to their CORS settings () 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

[](#custom-config)

The partytown configuration is available in `window.partytown` so you can change the configuration by updating the configuration within `` tags.

### Running partytown but not for GTM

[](#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.

```
@push('head')
    @include('rapidez-gtm::partytown.index')
@endpush
```

License
-------

[](#license)

GNU General Public License v3. Please see [License File](LICENSE) for more information.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance63

Regular maintenance activity

Popularity32

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Recently: every ~43 days

Total

42

Last Release

185d ago

Major Versions

1.0.0 → 2.0.02024-05-28

2.1.3 → 3.0.02024-12-13

2.1.4 → 3.1.02025-04-10

2.x-dev → 3.2.12025-06-03

3.x-dev → 4.0.02025-06-05

PHP version history (3 changes)0.1.0PHP ^8.0|^8.1

1.0.0PHP ^8.0|^8.1|^8.2

3.1.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/72222911?v=4)[Rapidez](/maintainers/rapidez)[@rapidez](https://github.com/rapidez)

---

Top Contributors

[![royduin](https://avatars.githubusercontent.com/u/1703233?v=4)](https://github.com/royduin "royduin (46 commits)")[![indykoning](https://avatars.githubusercontent.com/u/15870933?v=4)](https://github.com/indykoning "indykoning (34 commits)")[![Jade-GG](https://avatars.githubusercontent.com/u/32514269?v=4)](https://github.com/Jade-GG "Jade-GG (9 commits)")[![danielsmink](https://avatars.githubusercontent.com/u/2118314?v=4)](https://github.com/danielsmink "danielsmink (1 commits)")[![BobWez98](https://avatars.githubusercontent.com/u/23509926?v=4)](https://github.com/BobWez98 "BobWez98 (1 commits)")[![claudio-ferraro](https://avatars.githubusercontent.com/u/54107647?v=4)](https://github.com/claudio-ferraro "claudio-ferraro (1 commits)")[![VincentBean](https://avatars.githubusercontent.com/u/3906942?v=4)](https://github.com/VincentBean "VincentBean (1 commits)")

---

Tags

rapidez

### Embed Badge

![Health badge](/badges/rapidez-gtm/health.svg)

```
[![Health](https://phpackages.com/badges/rapidez-gtm/health.svg)](https://phpackages.com/packages/rapidez-gtm)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
