Comments on: How to setup Google Analytics event tracking in Divi/WordPress https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/ Boost the power of your Divi website Fri, 17 Nov 2023 12:41:04 +0000 hourly 1 https://wordpress.org/?v=6.5.4 By: Roel https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-224484 Wed, 01 Mar 2023 10:36:21 +0000 https://diviengine.com/?p=4389#comment-224484 I would like to do this for a DIVI EMAIL OPTIN form. Can you help me out?

]]>
By: Mario https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-221393 Wed, 25 Jan 2023 12:19:58 +0000 https://diviengine.com/?p=4389#comment-221393 Hello!!!! It does not work for me with Google Analytics 4 also known as GA4. Help!

]]>
By: Claire https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-194444 Sat, 30 Apr 2022 08:56:52 +0000 https://diviengine.com/?p=4389#comment-194444 Have you got an update for this when using G4 properties?

]]>
By: Sambo https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-188542 Sun, 13 Feb 2022 08:04:18 +0000 https://diviengine.com/?p=4389#comment-188542 As the message states below the form trigger once the form submits button is triggered not whether someone has actually filled in the data. (This is using the divi form) Thanks

]]>
By: Quratulain https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-174948 Fri, 06 Aug 2021 14:27:06 +0000 https://diviengine.com/?p=4389#comment-174948 In reply to Tufty.

Hi,

I have a similar problem to yours with the Divi contact form module with the divi theme. Were you able to resolve this?

I get this weird error Uncaught TypeError: jsForm.submit is not a function

and the GA event also fires regardless of form submission.

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-163579 Fri, 22 Jan 2021 09:35:58 +0000 https://diviengine.com/?p=4389#comment-163579 In reply to Tufty.

Sorry, not sure – we have not had time to look into this as super busy with updates for our plugins. If we get some time we can check but need to prioritize our time for the plugins and customers. Sorry

]]>
By: Tufty https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-163532 Thu, 21 Jan 2021 12:21:31 +0000 https://diviengine.com/?p=4389#comment-163532 In reply to Tufty.

Hi Divi. Is there any update on this? I cant get this code to work with the Divi theme andDivi contact module. (detecting clicks on phone numbers works great, but just not the form submission bit). Thanks! 🙂

]]>
By: Tufty https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-163173 Thu, 14 Jan 2021 08:40:50 +0000 https://diviengine.com/?p=4389#comment-163173 In reply to Divi Engine.

Hi Divi. Thanks for your quick reply! 🙂
We’re using Divi’s contact module.

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-163083 Tue, 12 Jan 2021 19:24:56 +0000 https://diviengine.com/?p=4389#comment-163083 In reply to Tufts.

It should work only when the form completes (submits ) what are you using for your form?

]]>
By: Tufts https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-163076 Tue, 12 Jan 2021 16:55:35 +0000 https://diviengine.com/?p=4389#comment-163076 Good article, but the form tracking doesnt work. It tracks every time the user clicks the Submit button, even if they havnt filled required fields. How can we make it so that it only tracks on successful submission?
It looks like the jqForm.submit() functiopn fire regardless.
Have a test and youll see what I mean.
Thanks

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-136364 Mon, 18 May 2020 08:01:10 +0000 https://diviengine.com/?p=4389#comment-136364 In reply to Dan JC.

It should only track those as it sends the data on form submit. If not successful, submit won’t fire.

]]>
By: Dan JC https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-136208 Sat, 16 May 2020 11:53:52 +0000 https://diviengine.com/?p=4389#comment-136208 This is great, but is there a way to only track successful contact form submissions? I’m able to do this with Contact Form 7, and I need to be able to with Divi forms too.

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-134819 Thu, 30 Apr 2020 11:24:22 +0000 https://diviengine.com/?p=4389#comment-134819 In reply to Jérémy.

I think it takes a little time for it to come through. Check back in the next few days and let me know if it shows.

]]>
By: Jérémy https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-134817 Thu, 30 Apr 2020 10:47:11 +0000 https://diviengine.com/?p=4389#comment-134817 Hello, great tutorial thank you.
I can see the stat in events but not in goals.
Any idea to make it show in goals or should i just wait an undefined time ?

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-102319 Mon, 02 Dec 2019 08:56:09 +0000 https://diviengine.com/?p=4389#comment-102319 In reply to Tomm.

Thank you for the kind words! Please share the article.

To confirm you question, you want to measure how many people click the link? This would require some more development and even database code which is quite complicated. I would not really recommend it either as it could clog up your WordPress database and it will become huge and slow.

Maybe someone else has a good solution?

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-102308 Mon, 02 Dec 2019 08:53:59 +0000 https://diviengine.com/?p=4389#comment-102308 In reply to Tomm.

This error has to do with Ajax I think not working. I believe it is when the page gets reloaded before the Ajax can fire. What are you adding this code on – a Ajax contact form?

]]>
By: Tomm https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-101429 Sun, 01 Dec 2019 12:42:32 +0000 https://diviengine.com/?p=4389#comment-101429 I would like to know if it would be possible to place a code to measure the clicks of any link/element. Your article is so brilliantly written, that only the first time I was able to do this measurement – on other pages over the months I found nothing more sensible. Thank you!

]]>
By: Tomm https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-101427 Sun, 01 Dec 2019 12:26:22 +0000 https://diviengine.com/?p=4389#comment-101427 Thank you for the article. Works properly, but I have a question – the console displays yes:
event sent ok
XHR failed loading: POST

I’m asking for information on what this could mean?

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-95103 Mon, 11 Nov 2019 12:04:49 +0000 https://diviengine.com/?p=4389#comment-95103 In reply to Jonathan B..

Not sure how I can explain it easier here. I suggest using the plugin that I mention and look at the screenshots above to copy

]]>
By: Jonathan B. https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-94970 Sun, 10 Nov 2019 12:34:30 +0000 https://diviengine.com/?p=4389#comment-94970 Hi,

“I have added the id “contact” to our module that has the contact form – you can see the way it is setup below in the screenshot of the code inspect – the form is housed in the div id called contact.”

I don’t understand that part, I’m not familiar with Divi. Please can you explain where to do that more precisely.

Thanks in advance.

Regards

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-73230 Thu, 29 Aug 2019 07:39:45 +0000 https://diviengine.com/?p=4389#comment-73230 In reply to Mr. Dif.

Thank you for the kind words and the comment! Can you email he***@di********.com with the URL of your website where the newsletter sign up is, will try see what can be done

]]>
By: Mr. Dif https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-73177 Thu, 29 Aug 2019 04:59:14 +0000 https://diviengine.com/?p=4389#comment-73177 Fantastic code! Wondering if you’d need to change anything to track contact form submissions when they’re set to add the submission to a newsletter. In this case, submits are sent to MailChimp but the events are not showing up and there’s no console message.

Btw I love your theme design on the Divi Engine site.

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-70199 Fri, 16 Aug 2019 12:02:33 +0000 https://diviengine.com/?p=4389#comment-70199 In reply to Steve.

True. Did you change the analytics code “UA-xxxxxxxxxx-x” to be your tracking UA?

]]>
By: Steve https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-70195 Fri, 16 Aug 2019 11:40:11 +0000 https://diviengine.com/?p=4389#comment-70195 Hi thanks for this, I’m trying to do this manually as outdated plugins worry me a bit aren’t they a potential security flaw?

I want to track email clicks and phone clicks, but it doesn’t seem to be working, any idea why?

jQuery(document).ready(function($){
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga(‘create’, ‘UA-xxxxxxxxx-x’, ‘auto’); // change UA-xxxxxxxxx-x to be your tracking UA.

$( ‘a[href^=”mailto:”]’ ).click(function(event) {
var href = $(this).attr(“href”);
var target = $(this).attr(“target”);
var text = $(this).text();
event.preventDefault(); // prevent the form from submitting so we can sent the tracking code, then continue with the submission later.
ga(‘send’, {
hitType: ‘event’,
eventCategory: ’email’, // add any name for the category
eventAction: ‘Clicked’ // add any name for the action
});
setTimeout(function() { // now wait 300 milliseconds…
window.open(href,(!target?”_self”:target)); // …and open the link as usual
console.log(“email clicked”);
},300);
});

});

$( ‘a[href^=”tel:”]’ ).click(function(event) {
var href = $(this).attr(“href”);
var target = $(this).attr(“target”);
var text = $(this).text();
event.preventDefault(); // prevent the form from submitting so we can sent the tracking code, then continue with the submission later.
ga(‘send’, {
hitType: ‘event’,
eventCategory: ‘Phone Number’, // add any name for the category
eventAction: ‘Clicked’ // add any name for the action
});
setTimeout(function() { // now wait 300 milliseconds…
window.open(href,(!target?”_self”:target)); // …and open the link as usual
console.log(“tel clicked”);
},300);
});

});

]]>
By: Jan Petrtyl https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-51949 Fri, 31 May 2019 14:41:17 +0000 https://diviengine.com/?p=4389#comment-51949 In reply to Divi Engine.

I can confirm that the plugin works well and is helpful. Thank you.

]]>
By: Jan https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-51914 Fri, 31 May 2019 08:34:03 +0000 https://diviengine.com/?p=4389#comment-51914 In reply to Divi Engine.

Hello, thanks a lot for your response. I will test it and let you know how it works! I really appreciate your help!

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-45578 Wed, 08 May 2019 08:09:36 +0000 https://diviengine.com/?p=4389#comment-45578 In reply to Jan.

Hey Jan,

We have fixed the formatting issues – please let me know if it works for you now?

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-45264 Mon, 06 May 2019 19:24:11 +0000 https://diviengine.com/?p=4389#comment-45264 In reply to Jan.

Hey Jan,

Thanks for the comment – yeah the plugin is out of date but I have not had any issues with it and it works so well so keep using it on some sites. It is easy enough to code it.

The blog post above has some formatting issues so the code is not showing, I will fix this and let you know (tomorrow or the next day as been away for 4 days so need to catch up).

Is this ok?

]]>
By: Jan https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-45125 Mon, 06 May 2019 10:26:10 +0000 https://diviengine.com/?p=4389#comment-45125 Hi, thanks for the post, but I cannot see the code that would track phone calls, that I could enter manually, and the plugin seems outdated 🙁 Could you specify Step n. 2 in more detail?

Thank you!

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-36299 Mon, 25 Mar 2019 11:00:49 +0000 https://diviengine.com/?p=4389#comment-36299 In reply to alex.

I would have to write a tutorial on how to do this manually but I know the plugin referenced in the post allows to track this. They add a class to the link called “.gtrackexternal” and then track it there. If you are using the plugin go the settings page and check for “All External Links”.

If you know code and want to do it manually, try adding this to the start so that it adds the CSS class gtrackexternal:

$('a').each(function() {
if ((!host.test(this.href) && this.href.slice(0, 1) != "/" && this.href.slice(0, 1) != "#" && this.href.slice(0, 1) != "?" && this.href.slice(0, 10) != "javascript")) {
$(this).addClass('gtrackexternal');
}
});

Now you can use this to track the external links

Does this help?

]]>
By: alex https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-35566 Fri, 22 Mar 2019 08:35:26 +0000 https://diviengine.com/?p=4389#comment-35566 Should be possible to use this for tracking clicks on outbound links?Do you have an example?

Thank you!

]]>
By: Divi Engine https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-9141 Tue, 11 Dec 2018 22:16:20 +0000 https://diviengine.com/?p=4389#comment-9141 In reply to Katie.

Hi Kaite,
I had not seen this before – not sure why.

It works perfectly and actually used it last week so still think it is good. Alternatively, you can use the custom method above.

Thanks for the comment 😀

]]>
By: Katie https://diviengine.com/setup-google-analytics-event-tracking-diviwordpress/#comment-9129 Tue, 11 Dec 2018 21:10:19 +0000 https://diviengine.com/?p=4389#comment-9129 Hi There,
I went to the plugin page and it has a big warning about compatibility issues, due to lack of updates etc
Do you know if its ok to use with recent versions of wordpress and divi?

]]>