Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Documentation edits made through Mintlify web editor

mintlify[bot]c5bc02cbfb96
diff --git a/docs/docs.json b/docs/docs.json
index 8da03298a6..9e87232fd2 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -858,7 +858,8 @@
{
"group": "Analytics",
"pages": [
- "integrations/analytics/google-analytics"
+ "integrations/analytics/google-analytics",
+ "integrations/analytics/google-tag-manager"
]
},
{
diff --git a/docs/images/integrations/google-tag-manager/1.integrations_tab.png b/docs/images/integrations/google-tag-manager/1.integrations_tab.png
new file mode 100644
index 0000000000..a71d7879fb
Binary files /dev/null and b/docs/images/integrations/google-tag-manager/1.integrations_tab.png differ
diff --git a/docs/images/integrations/google-tag-manager/2.gtm_form.png b/docs/images/integrations/google-tag-manager/2.gtm_form.png
new file mode 100644
index 0000000000..089a7c962b
Binary files /dev/null and b/docs/images/integrations/google-tag-manager/2.gtm_form.png differ
diff --git a/docs/images/integrations/google-tag-manager/3.gtm_id.png b/docs/images/integrations/google-tag-manager/3.gtm_id.png
new file mode 100644
index 0000000000..d20cef2229
Binary files /dev/null and b/docs/images/integrations/google-tag-manager/3.gtm_id.png differ
diff --git a/docs/images/integrations/logos/google_tag_manager.png b/docs/images/integrations/logos/google_tag_manager.png
new file mode 100644
index 0000000000..c84c74606d
Binary files /dev/null and b/docs/images/integrations/logos/google_tag_manager.png differ
diff --git a/docs/integrations/analytics/google-tag-manager.mdx b/docs/integrations/analytics/google-tag-manager.mdx
new file mode 100644
index 0000000000..4ee886a4c1
--- /dev/null
+++ b/docs/integrations/analytics/google-tag-manager.mdx
@@ -0,0 +1,78 @@
+---
+title: "Connect Google Tag Manager to Spree Commerce"
+sidebarTitle: Google Tag Manager
+description: "Learn how to set up and manage Spree’s native Google Tag Manager integration."
+---
+
+Spree’s Google Tag Manager integration allows you to connect your store to GTM, giving you full control over custom tags, marketing scripts, and other analytics tools all from within your GTM workspace. This setup uses Spree’s ecommerce dataLayer to send rich event data to GTM with no custom coding required.
+
+<Warning>
+ This integration allows you to use either Google Tag Manager or Google Analytics 4 - but not both at the same time. Only one key (GTM or GA4) should be active in the integration settings. If you plan to use GA4 with GTM, you must set up GA4 inside of GTM manually.
+</Warning>
+
+## Requirements
+
+To use this integration, you’ll need:
+
+- An active Google Tag Manager account
+- A GTM container set up for your store
+- Any additional tools (e.g., Google Analytics 4, conversion tracking, custom tags) configured within GTM
+
+Spree will automatically push ecommerce events to the dataLayer, but it’s up to you to configure tags and triggers in your GTM workspace.
+
+## Installation
+
+Before you can enable Google Tag Manager, it must be installed. To do so, you need to run the following command:
+
+```bash
+bundle add spree_google_analytics && bundle exec rails g spree_google_analytics:install
+```
+
+After that, make sure to restart your server if it was running.
+
+## Connect Google Tag Manager
+
+Sign in to your Spree admin dashboard and navigate to the Integrations tab.
+
+![](/images/integrations/google-tag-manager/1.integrations_tab.png)
+
+Locate the Google Analytics tile under Analytics and click **Connect Google Analytics.**
+
+This will redirect you to the setup page for Google Tag Manager integration.
+
+![](/images/integrations/google-tag-manager/2.gtm_form.png)
+
+Ignore the GA4 Measurement ID field.
+
+Paste your GTM Container ID (e.g., GTM-XXXXXXX) into the Google Tag Manager Key field.
+
+![](/images/integrations/google-tag-manager/3.gtm_id.png)
+
+Finally, click **Create** to activate the integration.
+
+## Event Tracking
+
+Spree sends a full suite of ecommerce events to the GTM dataLayer. This allows you to create triggers and tags based on:
+
+- Product views
+- Cart actions (add/remove)
+- Checkout progress
+- Payment info added
+- Purchase confirmation
+- Search activity
+- Wishlist adds
+- Newsletter signups
+- User engagement (sessions, first visits, etc.)
+
+To make use of these events, you'll need to configure appropriate tags and triggers inside your GTM container.
+
+## Manage Your Integration
+
+To remove the integration or switch between GTM and GA4:
+
+Return to the integration setup page in Spree and either:
+
+- Clear the GTM field and enter a GA4 Measurement ID, or
+- Click Delete in the lower-right corner to remove the integration completely
+
+<Note>Only one analytics key should be set at a time (GA4 or GTM).</Note>
\ No newline at end of file
diff --git a/docs/integrations/integrations.mdx b/docs/integrations/integrations.mdx
index 7d4b2deea4..94fa96de26 100644
--- a/docs/integrations/integrations.mdx
+++ b/docs/integrations/integrations.mdx
@@ -27,6 +27,9 @@ description: "Learn how to connect your Spree Commerce store to third-party serv
<Card title="Google Analytics 4" href="/integrations/analytics/google-analytics" img="/images/integrations/logos/google-analytics.png">
Google Analytics 4 is a powerful analytics tool that allows you to track user behavior, sales performance, and marketing effectiveness across your store.
</Card>
+ <Card title="Google Tag Manager" href="/integrations/analytics/google-tag-manager" img="/images/integrations/logos/google_tag_manager.png">
+ Google Tag Manager is a flexible tag management tool that lets you deploy and control marketing, analytics, and tracking scripts across your store.
+ </Card>
</CardGroup>
## Marketing
@@ -40,10 +43,10 @@ description: "Learn how to connect your Spree Commerce store to third-party serv
## SSO, MFA & Social Login
<CardGroup>
- <Card title="SSO & MFA for the Admin Panel" href="/integrations/sso-mfa-social-login/admin-dashboard">
+ <Card title="Admin Panel SSO & MFA" href="/integrations/sso-mfa-social-login/admin-dashboard">
Learn how to secure your Spree admin panel with SSO and MFA integration, using Microsoft Entra ID as an example.
</Card>
- <Card title="SSO & Social Login for the Storefront" href="/integrations/sso-mfa-social-login/storefront">
+ <Card title="Storefront SSO & Social Login" href="/integrations/sso-mfa-social-login/storefront">
Enable customer-facing SSO and social login on your Spree storefront, using Microsoft Entra External ID as an example.
</Card>
</CardGroup>