@capgo/capacitor-gtm
Google Tag Manager integration for analytics and tracking
Overview
Section titled “Overview”Google Tag Manager integration for analytics and tracking
Start with initialize() and the other core methods listed below.
Platform support
Section titled “Platform support”| Platform | Support | Notes |
|---|---|---|
| iOS | Yes | Native |
| Android | Yes | Native |
| Web | No | Guard with Capacitor.getPlatform() |
Core Capabilities
Section titled “Core Capabilities”initialize- Initializes Google Tag Manager with the specified container ID.push- Pushes an event to the Google Tag Manager dataLayer.setUserProperty- Sets a user property in the Google Tag Manager dataLayer.getValue- Gets a value from the Google Tag Manager dataLayer. Searches through the dataLayer for the most recent value of the specified key.
Public API
Section titled “Public API”| Method | Description |
|---|---|
initialize | Initializes Google Tag Manager with the specified container ID. |
push | Pushes an event to the Google Tag Manager dataLayer. |
setUserProperty | Sets a user property in the Google Tag Manager dataLayer. |
getValue | Gets a value from the Google Tag Manager dataLayer. Searches through the dataLayer for the most recent value of the specified key. |
reset | Resets the Google Tag Manager instance and clears all data. This will remove all data from the dataLayer and require re-initialization. |
getPluginVersion | Get the native Capacitor plugin version. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-gtm.
Keep going from @capgo/capacitor-gtm
Section titled “Keep going from @capgo/capacitor-gtm”If you are using @capgo/capacitor-gtm to plan native plugin work, connect it with Using @capgo/capacitor-gtm for the native capability in Using @capgo/capacitor-gtm, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins, and Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives.