
Ralph Module for GTM
GTM module for Ralph that will push the following events to the datalayer:
add_to_cart
- One or more products are added to the cartremove_from_cart
- One or more products are removed from the cartview_item
- A product page is viewedview_item_list
- A product in a list is scrolled into viewselect_item
- A product in a list is clickedbegin_checkout
- The checkout page has been enteredpurchase
- A purchase has been madeoriginal_location
- The page where the user enters the sitevirtual_page_view
- A new navigation has been madepage_data
- A page has been loadedadd_to_wishlist
- A product has been added to the wishlist
Requirements
This package require Nuxt 2 to be installed in your project. It also requires @ralph/ralph-ui 19.4.0 or higher.
Installation
npm install @geins/ralph-module-gtm
Usage
Once installed, you can add the module to your Nuxt 2 app by updating the modules array in the nuxt.config.js file. You can then configure the module by adding options to the @geins/ralph-module-gtm
object:
module.exports = {
modules: [
[
'@geins/ralph-module-gtm',
{
debug: false,
enabled: true,
gtm: {},
itemId: 'productId',
propOverrides: []
}
]
]
}
License
MIT
Note
If you are already using the @nuxtjs/gtm
module, you should uninstall it and use this module instead, which will include the @nuxtjs/gtm
module as a dependency. If you are using the internal GTM events of Ralph, you should disable them by setting useExternalGtm
to true in the publicRuntimeConfig
of you nuxt.config.js file.