Skip to content

@capgo/capacitor-gtm

The main interface for the Google Tag Manager plugin.

The main interface for the Google Tag Manager plugin.

  • 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.
MethodDescription
initializeInitializes Google Tag Manager with the specified container ID.
pushPushes an event to the Google Tag Manager dataLayer.
setUserPropertySets a user property in the Google Tag Manager dataLayer.
getValueGets a value from the Google Tag Manager dataLayer. Searches through the dataLayer for the most recent value of the specified key.
resetResets the Google Tag Manager instance and clears all data. This will remove all data from the dataLayer and require re-initialization.
getPluginVersionGet the native Capacitor plugin version.

This reference is synced from src/definitions.ts in 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.