silvershop-suite / conversion-tracking-google
Google connector for silvershop-suite/conversion-tracking: GA4 ecommerce events (view_item / add_to_cart / begin_checkout / purchase) via gtag, a Google Ads conversion on purchase, Enhanced Conversions (hashed email, hashed client-side by Google) and Consent Mode v2 inherited from silvershop-suite/c
Package info
github.com/silvershop-suite/silvershop-conversion-tracking-google
Type:silverstripe-vendormodule
pkg:composer/silvershop-suite/conversion-tracking-google
Requires
- php: ^8.3
- silvershop-suite/conversion-tracking: ^1.0
- silverstripe/cms: ^6
- silverstripe/framework: ^6
Requires (Dev)
- cambis/silverstan: ^2.1
- phpunit/phpunit: ^11.3
- silverstripe/sqlite3: ^4
- squizlabs/php_codesniffer: ^3.7
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-23 14:33:25 UTC
README
Google connector for silvershop-suite/conversion-tracking.
It implements the core's ConversionProvider seam for Google, client-side via gtag:
- GA4 ecommerce —
view_item/add_to_cart/begin_checkout/purchase, withitems[],value,currencyandtransaction_id(= the order id) on purchase. - Google Ads — a conversion on purchase (
gtag('event','conversion',{send_to:'AW-ID/LABEL',…})). - Enhanced Conversions —
gtag('set','user_data', …)with the raw email / phone / address (Google hashes them client-side), fired before the conversion. - Consent Mode v2 — inherited from
silvershop-suite/cookieconsent(which emits thedefault+updateand maps the categories toad_storage/ad_user_data/ad_personalization/analytics_storage). This connector does not reinvent it; it only ensuresgtagloads + the events fire. GA4 is gated onstatistics, the Ads conversion + Enhanced Conversions onmarketing.
Install
composer require silvershop-suite/conversion-tracking-google
Registers + switches itself on, inert until configured. Set the environment:
SS_GA4_MEASUREMENT_ID=G-XXXXXXXXXX # GA4 measurement id
SS_GOOGLE_ADS_CONVERSION_ID=AW-XXXXXXXX # optional — Google Ads conversion id
SS_GOOGLE_ADS_PURCHASE_LABEL=abcLabel # optional — the Ads purchase conversion label
Mode is configurable (datalayer_only | built_in_tags | both, default both):
SilverShop\ConversionTracking\Google\GoogleProvider: mode: both
Deduplication
GA4 purchase carries transaction_id = {OrderID}, so a re-view of the confirmation page does not double-count,
and the id matches the one the core mints for the Meta Pixel/CAPI pair.
v1 scope
v1 is client-side only. The server-side path (Google's Data Manager API — the post-2026 replacement for the retired Ads-API offline upload) is v2, so this connector reports no server-side support; the core never enqueues a server dispatch for it.
Consent Mode SSR-default note.
silvershop-suite/cookieconsentemits the server-sidegtag('consent','default', …denied)in<head>only when theGA_CODE/GTM_CODEenv var is set; otherwise its JS runtime emits the default-denied before any tag activates. For a belt-and-suspenders SSR default, set one of those env vars. This connector does not emit a competing default.In v1 the gtag library is loaded gated on analytics (
statistics) consent when GA4 is configured, so a Google-Ads-only-without-analytics setup should loadgtag.jsvia GTM instead.
Privacy / GDPR
- Enhanced-Conversions PII is sent raw (Google hashes it client-side) and only with
marketingconsent. - Data is sent to Google (US) — declare this processor relationship (DPA + SCCs) in your privacy policy.
Development
composer install composer lint # PHP_CodeSniffer (PSR-12) composer stan # PHPStan (silverstan, level 5) composer test # PHPUnit
silvershop-suite/conversion-tracking is an RVXD module resolved from the composer repositories VCS entry (a private
core repo needs a GitHub token — see the CI workflow).
Licence
BSD-3-Clause.
Credits
Built and maintained by Remy Vaartjes (remy@xd.nl) — part of the SilverShop-Suite.