Google Tag Manager - Track AddToWishlist events with ecommerce data regarding specific product added

Google Tag Manager - Track AddToWishlist events with ecommerce data regarding specific product added

Kristian3
Visitor
3 0 0

Hi there

I am trying to setup tracking of add to wishlist events for Facebook and GA4 using Google Manager. 

I see the following code in the theme.liquid file:

<!-- GTM DataLayer push events for all pages -->
{% include 'dataLayer' %}

I have have events with the relevant ecom data being pushed into the dataLayer for view_item, view_item_list, add_to_cart, purchase etc. But there's not an event being pushed when a user adds a product to their wishlist.

Is there a smart way to setup tracking of this event with the relevant ecom data without using an app to create the dataLayer push or use the custom pixel functionality - maybe it's possible to adjust the code in the theme?

I hope somebody has had a similar issue and found a way to solve it without custom pixels/ apps.

Thanks in advance

Sincerely, 

Kristian

Replies 5 (5)

PageFly-Theodor
Shopify Partner
691 86 100

Hi @Kristian3 ,
This is Theodore from PageFly - Shopify Page Builder App.

Modifying Shopify's theme.liquid code directly to track "add to wishlist" events is risky due to potential theme updates. Here's a safer alternative using Google Tag Manager (GTM):

  1. Create a Custom HTML Tag in GTM: Include a script that pushes a custom event named "add-to-wishlist" to the dataLayer when the wishlist button is clicked.

  2. Implement a Trigger: Set up a trigger in GTM to fire this tag specifically when the wishlist button is clicked.

  3. Enrich DataLayer (Optional): Modify the script to add relevant product information like name and ID to the event data.

  4. Configure Facebook & GA4 Tags: Create separate tags in GTM for Facebook and GA4 to utilize the "add-to-wishlist" event and associated data for tracking purposes.

Best regards,
Theodore | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

Kristian3
Visitor
3 0 0

Hi Theodore
Thank you for the reply. It's very much appreciated. 
The approach you suggest seems like ta good way to track add to wishlist events without custom pixel/ apps. 


However, step 3 is going to be difficult. This is due to the ecom data available: 
main page - no ecom data
category page - ecom data for multiple products in the datalayer and I am not sure how to differentiate between the one actually clicked

product page - here's the issue that although you have ecom for the specific product there are also suggested products you can add to wish list below the primary product without ecom data. 

If you have an idea how that could be solve, I would appreciate it. But it seems like a difficult task - unless you have an idea on how you could push a new datalayer with the relevant data in the HTML tag.

Thanks in advance

Kristian 

 

proshop_analyst
Tourist
13 0 0

Hey Kristian,

is your problem solved? i have a data layer for the step 3 mentioned by Theodore from PageFly for page view to purchase event and dynamic value tracking. Let me know if you're still facing the issue.

kind regards

GTM
Kristian3
Visitor
3 0 0

Hi Jalal

Thanks for the response.

In terms of tracking "add to wishlist" events with ecom data from a custom dataLayer push (since Shopify does not push data automatically) I have yet to find a solution. 

I have settled with the idea that these events will be tracked some time in the future when I start looking into tracking using custom pixels. But that's not just around the corner. 

If you have a code for tracking add to wishlist events I would be happy if you can share. 

Thanks in advance

Sincerely, 

Kristian




 

tracking_kingjf
Shopify Partner
1 0 0

If you still facing the error. Then I can Help you

Thank you