Jump to content
Sign in to follow this  
thisismatt

GA4 (Google Analytics 4) event tracking in complete.tpl

Recommended Posts

Whilst GA4 is relatively new, I'm surprised to not be able to find much talk, let alone any references, on how to include the necessary data layer events within WHMCS' order form template files. What little I have found is so very out-of-date and no longer applicable (that I can see, anyway).

So, looking at https://developers.google.com/analytics/devguides/collection/ga4/ecommerce#purchase as a starter, I can't work out how to include this example (including the example data, as I want to see it working) in /orderforms/standard_cart/complete.tpl.

Then, of course, is ensuring that my order-specific data replaces that of Google's example.

So, the short question here is - how do we include Google Analytics events within WHMCS template files?

Has no-one here done this (recently, so that it is still relevant to WMCS v8 and/or GA4)?

I don't suppose @brian! can offer some insight here?

As always, thanks for any help provided.

Edited by thisismatt

Share this post


Link to post
Share on other sites

Hi @thisismatt,

Our official Google Analytics module supports GA4 integration, check out this blog post for the info: https://blog.whmcs.com/133669/google-analytics-4-support-in-the-google-analytics-addon

If you need to add custom code in addition to that, please make sure curly braces are escaped: https://www.smarty.net/docs/en/language.escaping.tpl

Share this post


Link to post
Share on other sites

Hi John, thanks for replying.

So whilst I have indeed used your module to integrate GA4 within my WHMCS installation; I'm looking to add extra information from WHMCS to GA through 'enhanced ecommerce', which appears to require additional code within WHMCS to pass this data.

This is where I'm struggling to proceed; hence reaching out here for help.

Share this post


Link to post
Share on other sites
On 2/26/2021 at 8:46 PM, thisismatt said:

Hi John, thanks for replying.

So whilst I have indeed used your module to integrate GA4 within my WHMCS installation; I'm looking to add extra information from WHMCS to GA through 'enhanced ecommerce', which appears to require additional code within WHMCS to pass this data.

This is where I'm struggling to proceed; hence reaching out here for help.

Couldn't agree more, @thisismatt!

Being able to utilize GA's ecommerce tracking with WHMCS (besides the generic GA integration) would be an invaluable feature for customers and should definitely be incorporated into the standard WHMCS mix. 

If you haven't done so already, you should request this feature so that members  can upvote it.

Share this post


Link to post
Share on other sites

Hi @thisismatt,

What's the nature of the issue you experience after adding it to complete.tpl and making sure any curly braces are escaped by a blank space?

To test, I suggest placing an order and making a payment. Any syntax errors will be logged to the Configuration > System Log.

 

Share this post


Link to post
Share on other sites
On 2/26/2021 at 9:16 PM, WHMCS John said:

Hi @thisismatt,

Our official Google Analytics module supports GA4 integration, check out this blog post for the info: https://blog.whmcs.com/133669/google-analytics-4-support-in-the-google-analytics-addon

If you need to add custom code in addition to that, please make sure curly braces are escaped: https://www.smarty.net/docs/en/language.escaping.tpl

Is this tracking revenue GA4 by default? Or additional configuration is required?

I was able to config conversion flow - but the revenue value is not being populated.

Share this post


Link to post
Share on other sites

So, how could we get add-to-cart events, and all dataLayer parameters, initiate checkout events and all parameters??

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By SwiftModders
      SwiftModders specializes in premium, responsive WHMCS Themes designed to make your business stand out from your competition! Please look at what our customers say about us on WHMCS Marketplace and Trustpilot.
      All WHMCS Themes provided by SwiftModders are powered by our custom-built Theme Installer module that allows you to:
      Customize the settings for your theme installations Update your theme automatically Provide debugging tools, health checks, and license management Menu management system to customize your WHMCS navigation on-the-fly Developer-friendly CSS/SCSS editor support for advanced customizations ---
      Allure WHMCS Client Theme - Starts at $70 per year*
      Learn More | Purchase
      SwiftModders WHMCS Client Theme - Starts at $45 per year*
      Learn More | Purchase
      SwiftModders WHMCS Admin Theme - Starts at $35 per year*
      Learn More | Purchase
      *All prices above DO NOT reflect the 30% discount. One-time licenses are also available for all themes!
      ---
      Need something a little more custom?
      SwiftModders offers completely custom WHMCS theme development for businesses that want a better user experience and consistency with their brand. If that sounds like you, let's chat!
    • By WebsiteIntegrations
      WebsiteIntegrations.Com has just added 2 new WHMCS Templates to the WHMCS Market!
      These two new templates are great for Game Server Hosts! They include a new customized admin page you can use as your website front page!
      The two new themes are:
      WHMCS Ark Theme : https://marketplace.whmcs.com/product/6473-whmcs-ark-theme
      WHMCS Minecraft Theme: https://marketplace.whmcs.com/product/6475-whmcs-minecraft-theme
       
      Check out our growing selection of whmcs themes and orderforms on the marketplace https://marketplace.whmcs.com/group/Website-Integrations
      Use code 10PERCENT and save 10% off your purchase!
    • By (Amr)
      Today we are pleased to announce Lara Session rePlayer (beta) for WHMCS !
      Have you ever wondered what experience your clients receive when visiting your website ?!, what errors do they face ?!, how do they navigate your website ?!
      All these questions and more can now be answered, as this plugin will allow you to record and re-play their entire session, as if you were sitting with them while they navigate your website !
      See what confuses them, what attracts their attention and much much more.
      To make that happen, we blended the power of rrweb opensource recording software and WHMCS, and the Lara Session rePlayer was born.
      The plugin comes with a lot of exciting features, including but not limited to  :
      Works with any WHMCS client theme. Complete logging of errors and debug events. Record all sessions or limit the number of recording per day (to save disk space). The ability to limit recording size and length (to save disk space). Fully automated clean-up system, to delete old recordings (to save disk space). EU GDPR compliance, by only recording sessions after a consent cookie is set by the user (i.e., after accepting your website's cookie and privacy policy). All recorded sessions will be stored locally on your server, so no user data will be shared with 3rd parties. The ability to mask all inputs, to protect users' privacy. The ability to ignore recording certain input fields by type, name, class or id. Testing mode, where only sessions by logged in admins will be recorded. We are in a closed beta stage, currently testing the plugin and getting feedback from selected beta testers, before releasing the final version.
      We welcome any feedback or feature request, to make Lara Session rePlayer the one stop solution for recording WHMCS sessions.
      If you would like to join our beta testers, please open a support ticket at : https://clients.xtraorbit.com/submitticket.php?step=2&deptid=2&subject=Lara-Session-rePlayer-Beta-Tester
      The beta tester program is only available to our current active customers. If you don't currently have an active account with us, feel free to post your feedback or feature request in this post.
       
      You may watch the demo video of the plugin here :
       
      Main Screen :

       
      Settings Page :

       
      Have a lovely day !
       
    • By WebsiteIntegrations
      WebsiteIntegrations.Com has just added 3 new Comparison Orderforms to the WHMCS Market!
      These work as a Child Orderforms to the Standard_Cart Orderform and provides a new look to the Product Page.
      The new orderforms are:
      Dark Compare Orderform - https://marketplace.whmcs.com/product/6402-dark-compare-orderform
      Bootstrap Compare Orderform - https://marketplace.whmcs.com/product/6401-bootstrap-compare-orderform
      Clean Compare Orderform - https://marketplace.whmcs.com/product/6399-clean-compare-orderform
       
      We will be adding more soon! You can watch here for all our Template and Orderform offerings https://marketplace.whmcs.com/group/Website-Integrations
    • By EduardoKST
      Hello
      I want to biuld an web2app for android for client area but i want to use other template for that different from whmcs main template, but this to be available only in my android app.
      I have buyed an android web2app because i am so begginer android developer but i don't know how to force a specific template on my android app.
      Is there any people who have a solution about that force of a template in client area in any mode.
      Thanks and i wait some opinions
       
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated