Commerce Google Tag Manager module provides following rule actions:
1. Send "Add to Cart" event to google analytics via GTM
2. Send "Remove from Cart" event to google analytics via GTM
3. Send "Checkout" event to google analytics via GTM
4. Send "Purchase" event to google analytics via GTM
Created following 4 rules:
1. Send Add to Cart Details to GA via GTM
Event: After adding a product to the cart
Action: Send "Add to Cart" event to google analytics via GTM
2. Send Remove From Cart to GA via GTM (Not having any session in GTM to track these details)
Event: After removing a product from the cart
Action: Send "Remove from Cart" event to google analytics via GTM
3. Send Checkout Complete Details to GA via GTM
Event: Completing the checkout process
Action: Send "Purchase" event to google analytics via GTM
4. Send Checkout Process Details to GA via GTM
Event: Process a change to the checkout page (Enabled Commerce Rules Extra module for this event)
Action: Send "Checkout" event to google analytics via GTM
Using above 4 rules data is tracking properly under Ecommerce -> Shopping Analysis->Shopping Behavior Analysis to 'All Sessions', 'Sessions with Add to Cart', 'Sessions with Check-Out', 'Sessions with Transactions' but 'Sessions with Product Views' is empty. Please help.
How to track Sessions with Product Views data to Google Analytics via GTM in drupal 7?
Comment | File | Size | Author |
---|---|---|---|
#16 | interdiff_5_16.txt | 7.62 KB | wizonesolutions |
#16 | 2712821_16.patch | 12.39 KB | wizonesolutions |
Comments
Comment #2
vasikei think is about the version 2 of the module and it seems not implemented yet.
Not sure how this could be done, as there could be different implementations for Drupal Commerce products and products displays.
Maybe an API that could be customized as needed.
Comment #3
prachi@fantailtech.com CreditAttribution: prachi@fantailtech.com commentedComment #4
vasikeHere is patch for this:
Comment #5
vasikeNew patch with 2 updates for previous patch:
- correct the products data array
- add "detail" event for Product details event
interdiff available.
Comment #6
mediamash CreditAttribution: mediamash commentedGood morning - could these be added to the next version of the module? Are there any plans for an update?
Comment #7
mediamash CreditAttribution: mediamash commented@vasike After applying the patch succesfully, I can see it changed the files and added new ones, but nothing no rule is created. Can you export yours to make it work then?
Comment #8
mediamash2 CreditAttribution: mediamash2 commented@vasike
apparently no rule is created because it is not mentioned under .../commerce_google_tag_manager/contrib/commerce_google_tag_manager_example.rules_defaults.inc
Could someone extend the function commerce_google_tag_manager_example_default_rules_configuration() please ?
Comment #9
mediamash2 CreditAttribution: mediamash2 commentedno rule created - so not working
Comment #10
guruslot CreditAttribution: guruslot commentedIs it possible to track product impressions (Views) also?
Comment #11
guruslot CreditAttribution: guruslot commentedDoes anybody have tried to implement Product impressions thru Views?
Comment #12
gauravkhambhala CreditAttribution: gauravkhambhala commentedThe other rules are getting created from Commerce Google Tag Manager - Example module which is a sub module within this module. This patch doesn't contain changes to sub module and hence the rules are not being created automatically.
Comment #13
wizonesolutionsTried this patch, but it doesn't work if products are being displayed directly. That admittedly makes some sense, but it doesn't work in my case. I'm going to try to add a Rules Action that works with
/product/$product_id
pages and add it to this patch. It's very similar, just that it will require the product directly and only take one argument (the product). I don't think the list makes sense for the default implementation. People can add that in an alter if needed.Comment #14
wizonesolutionsOh, fun! "Commerce Product is viewed" does not actually work since it's just generated from entity info. I'll have to check how we are rendering the actual page on our site and make a custom Rules event. I'll re-roll the patch then, but I'm not going to include a sample Rule. People can just clone one of the existing ones and fix it up, i.e. change the event to when a node of type (your product display) is viewed, and delete/change the action to the "product details" one. I'll leave in the product variation action I'm adding for edge cases like mine.
Comment #15
wizonesolutionsI think it works, but we're using a Commerce Panels setup. End result is the same in terms of the updated patch I'm going to attach once I'm done.
Comment #16
wizonesolutionsHere it is, with interdiff. It's basically like I said: no new rule, since our setup didn't facilitate that. I just call the "product variation" action directly. I didn't test the product display one, but it looks like it should work. As always, automated tests would be good, but I did not have the time to write them.
Someone might also want to add example rules for cases where this will work with Rules. This patch should also work with the latest dev.
Comment #17
apaderno