websavers Posted June 27, 2021 Share Posted June 27, 2021 In case anyone wants to dive headlong into GTM 4 (as this doesn't support anything earlier), check out our module on GitHub: https://github.com/websavers/WHMCS-Google-Tag-Manager As a developer GTM 4 is fantastic as the API for building events no longer feels like 7 different APIs hacked together with duplicate data everywhere. Granted its front end reporting tools can sometimes feel a bit weaker than the former enhanced analytics. Open to pull requests. 0 Quote Link to comment Share on other sites More sharing options...
FutureX Posted February 16, 2023 Share Posted February 16, 2023 This is exactly what was looking for! I wasn't getting the view_item, etc to fire with the basic WHCMS setup. 😞 But the add_to_cart doesn't seem to fire, I don't get any hits on that one. I'm using the Lagom theme V2.1.2 Thanks! 0 Quote Link to comment Share on other sites More sharing options...
websavers Posted February 16, 2023 Author Share Posted February 16, 2023 Hey @FutureX I took a look at the demo for the theme here: https://demo.rsstudio.net/lagom/cart.php?a=add&domain=register&rspage=default Since it doesn't utilize an actual cart page, there's no way for the add to cart event to be triggered. Rather than a separate cart page, it immediately begins checkout with a cart review at the top of the checkout page, so that means add_to_cart would be one and the same with begin_checkout. If you'd prefer it track checkout as an add_to_cart event, I'm afraid you'll need to modify the code found here: https://github.com/websavers/WHMCS-Google-Tag-Manager/blob/main/modules/addons/google_tag_manager/hooks.php Under the viewcart case on line 173, remove everything before the break; except these two lines: $event = 'add_to_cart'; $action = 'viewcart'; That should then track begin_checkout events as add_to_cart events instead. 0 Quote Link to comment Share on other sites More sharing options...
FutureX Posted February 16, 2023 Share Posted February 16, 2023 OK great, so I've modified it to this: case 'viewcart': $event = 'add_to_cart'; $action = 'viewcart'; break; Just tested it and it works! Thanks! 0 Quote Link to comment Share on other sites More sharing options...
FutureX Posted February 25, 2023 Share Posted February 25, 2023 @websavers For some reason I'm not getting the amounts on Google Analytics. I get the number of purchases and what those purchases are for but no dollar amount. Any way to fix that? Thanks! 0 Quote Link to comment Share on other sites More sharing options...
websavers Posted February 26, 2023 Author Share Posted February 26, 2023 I'm afraid I have no idea why that would be the case; you'll need to troubleshoot the code to find out; try putting a bunch of logActivity() calls with the data you want to find out about in relevant points in the code and see what you can find. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.