- Developed by: Smarty Studio | Martin Nestorov
- Plugin URI: https://github.com/mnestorov/smarty-gtm-events-for-woocommerce
Your support is greatly appreciated and will help ensure all of the projects continued development and improvement. Thank you for being a part of the community! You can send me money on Revolut by following this link: https://revolut.me/mnestorovv
This plugin pushes WooCommerce events to Google Tag Manager’s dataLayer
, enabling enhanced eCommerce tracking.
The SM - GTM Events for WooCommerce plugin enables tracking of key WooCommerce events in Google Tag Manager by pushing them to the dataLayer
. It covers critical eCommerce events such as product views, add to cart actions, and purchases, making it easier to set up tracking for enhanced eCommerce analytics.
- Upload the plugin folder to
/wp-content/plugins/
directory, or install it through the WordPress plugins screen. - Activate the plugin through the Plugins screen in WordPress.
- Ensure that Google Tag Manager is configured to listen to the custom events from this plugin.
The plugin tracks and pushes the following events to the dataLayer
:
Triggered on single product pages, this event provides detailed information about the viewed product.
Data Structure:
{
"event": "view_item",
"ecommerce": {
"currencyCode": "USD",
"detail": {
"products": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"category": "Category Name"
}
]
}
}
}
Triggered on product list pages, such as shop or category pages, to track product impressions.
Data Structure:
{
"event": "view_item_list",
"ecommerce": {
"currencyCode": "USD",
"items": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"category": "Category Name"
},
// Other products...
]
}
}
Fires when a product is added to the cart, capturing the product ID, name, price, and quantity.
Data Structure:
{
"event": "add_to_cart",
"ecommerce": {
"currencyCode": "USD",
"add": {
"products": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"quantity": 1
}
]
}
}
}
Triggered on the cart page to provide an overview of the items in the cart.
Data Structure:
{
"event": "view_cart",
"ecommerce": {
"currencyCode": "USD",
"items": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"quantity": 1
},
// Other cart items...
]
}
}
Fires when a product is removed from the cart, capturing details of the removed product.
Data Structure:
{
"event": "remove_from_cart",
"ecommerce": {
"currencyCode": "USD",
"remove": {
"products": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"quantity": 1
}
]
}
}
}
Triggered when the checkout process begins, capturing details of items currently in the cart.
Data Structure:
{
"event": "begin_checkout",
"ecommerce": {
"currencyCode": "USD",
"items": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"quantity": 1
},
// Other cart items...
]
}
}
Fires on the order confirmation page to log purchase details, including order ID, total revenue, tax, shipping, and items purchased.
Data Structure:
{
"event": "purchase",
"ecommerce": {
"currencyCode": "USD",
"purchase": {
"actionField": {
"id": "456", // Order ID
"affiliation": "Your Store Name",
"revenue": "59.99",
"tax": "5.00",
"shipping": "5.00"
},
"products": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"quantity": 1
}
// Other purchased items...
]
}
}
}
Triggered when payment information is submitted during checkout. This event captures cart details and the selected payment method.
Data Structure:
{
"event": "add_payment_info",
"ecommerce": {
"currencyCode": "USD",
"payment_type": "credit_card",
"items": [
{
"id": "123",
"name": "Sample Product",
"price": "49.99",
"quantity": 1
},
// Other cart items...
]
}
}
- WordPress 4.7+ or higher.
- WooCommerce 5.1.0 or higher.
- PHP 7.2+
For a detailed list of changes and updates made to this project, please refer to our Changelog.
Ensure Google Tag Manager is installed and configured on your site. You may need to add Google Analytics tags in GTM to fully utilize the events pushed to dataLayer.
If you find this script helpful and would like to support its development and maintenance, please consider the following options:
-
Star the repository: If you're using this script from a GitHub repository, please give the project a star on GitHub. This helps others discover the project and shows your appreciation for the work done.
-
Share your feedback: Your feedback, suggestions, and feature requests are invaluable to the project's growth. Please open issues on the GitHub repository or contact the author directly to provide your input.
-
Contribute: You can contribute to the project by submitting pull requests with bug fixes, improvements, or new features. Make sure to follow the project's coding style and guidelines when making changes.
-
Spread the word: Share the project with your friends, colleagues, and social media networks to help others benefit from the script as well.
-
Donate: Show your appreciation with a small donation. Your support will help me maintain and enhance the script. Every little bit helps, and your donation will make a big difference in my ability to keep this project alive and thriving.
Your support is greatly appreciated and will help ensure all of the projects continued development and improvement. Thank you for being a part of the community! You can send me money on Revolut by following this link: https://revolut.me/mnestorovv
This project is released under the GPL-2.0+ License.