Do you want an easy way to automatically track your Joomla! form events with Google Analytics? Great idea! Google Analytics is the most powerful website analytics tool, and allows you to track nearly every piece of data for your website. So, knowing which forms on your site drive the most conversions is a great way to know which are the most optimized so you can make improvements where needed.
In this article, we'll show you how to enable Google Analytics Event Tracking for Convert Forms and track form events like Conversion, Load and Error as Google Analytics Events in the most beginner-friendly way possible.
- Why Should I Track Form Events with Google Analytics?
- Set Up Google Analytics Tracking
- What Form Events are Tracked?
- Track Custom Events Using Javascript
- Frequently Asked Questions
Why Should I Track Form Events with Google Analytics?
Tracking your form with Google Analytics is important for evaluating form performance and allows you to learn more about your users. For example:
- Where do your users come from on the web?
- How long are people on your site?
- Which keywords and search terms are leading to more form traffic?
- What do users do on your site?
- How much time do they spend overall and on which pages?
Set Up Google Analytics Tracking
To enable Google Analytics Event Tracking for Convert Forms and send events to Google Analytics when someone submits a form, every time a form is loaded or even when a form error is occured.
Step 1: Find your Google Analytics ID
To find the Google Analytics ID, sign in to your Google Analytics account first and then follow the steps below:
- From the left sidebar, click Admin.
- Select an account from the menu in the Account column.
- Select the GA4 property from the menu in the Property column or click Create Property to create a new one.
- Click Data Streams, select the web data stream.
- Finally, copy the Measurement ID, at the top of the page as shown in the picture above.
Step 2: Configure the Google Analytics Tracker Plugin
Go to Extensions -> Plugins, search for the Convert Forms - Google Analytics Tracker plugin and click to edit it.
On the plugin settings, set your Google Analytics Tracking ID in the respective field as shown in the picture above.
Enable the plugin and click Save.
Step 3: Enable Form Events Tracking
After you've enabled the plugin, go to Convert Forms -> Forms and click to edit the form you'd like to track form events. Under the Behavior tab, a new panel is now available called Google Analytics Tracking where you can enable or disable the tracking of form events.
What form events are tracked?
Below you can find the events that are currently supported and you can expect to see in your Google Analytics Events section.
- Conversion: Fires when a form has been submitted successfully.
- Load: Fires when a form is found on the page during page load regardless if the form hasn't been seen yet by the user.
- Error: Fires when an error like a field validation error is occured.
Below there's a list of the events that are going to be supported in a future release.
- Submit (Not supported yet): Fires when a user attempts to submit a form regardless if the submission was successfull or not.
- Impression (Not supported yet): Fires when a form has been seen (element in viewport) by the visitor regardless if it has been submitted or not.
In case you're missing an important form event, please do let us know.
Track Custom Events Using Javascript
Developers can track and send custom events programmatically to Google Analytics by utilizing the track() method of the GoogleAnalyticsTracker object.
Syntax
The track() method accepts 3 arguments: The form's ID (Integer), the event label (String) and an optional callback (Function) to verify the event has been successfully tracked.
ConvertForms.GoogleAnalyticsTracker.track(form_id, event_label, function(success));
Track Field Focus Event
The example below fires the event "Email Focused" when the user focuses on the field email of the form #4.
window.addEventListener("DOMContentLoaded", function() {
var input = document.querySelector('#cf_4 input[name="cf[email]"]');
input.addEventListener("focus", function() {
ConvertForms.GoogleAnalyticsTracker.track(4, 'Email Focused');
})
});
Frequently Asked Questions
What are the requirements to use the Google Analytics Tracker?
You need an active Google Analytics account and Convert Forms Pro v2.3.0 at least.
How to verify that Google Analytics Tracker is working
To verify that the form events are successfully tracked, just log in to your Google Analytics account, click on the Real-Time section on the left and check if the events are coming well in the report.
Will this increase the loading time of my site?
The Google Analytics Tracker has no impact on the page speed because all the requests are asynchronous, meaning that the browser will continue to load and your users will not see any delay whatsoever.
What about GDPR (General Data Protection Regulation)?
The Google Analytics Tracker does not collect or send any personal information or form submissions to Google Analytics. The only form-related information sent is the name of the form.
Where can I see the events in Google Analytics?
There are two places that show events in Google Analytics.
- The real-time dashboard under Events section where an event should show up here in (almost) real-time.
- The full report can be found under Behavior > Events. Note that it can take up to 24 hours to show up in this section.
I have noticed that some events are missing in my Google Analytics account, compared to my backend numbers.
Possible reasons for not getting the accurate events are as below:
- If any javascript error is detected on the page may restrict tracker's code to get executed further.
- Some browsers and common ad-blocking programs block certain JavaScripts (including GA's script), which means Google Analytics is unable to record events.
- The user has left the page before the event has had a chance to send to Google Analytics.
Additionally, Google Analytics is a trend analysis tool, and as such cannot be expected to be 100% accurate. However, if the variance is greater than 10-12%, there might be an issue with the coding!
How do I track form events with Google Adwords?
Visit the How to Track Form Events with Google Adwords guide.
Does this plugin provide Facebook Pixel Tracking?
No. This plugin is all about tracking evens with Google Analytics only. If you're interested in tracking Joomla! Form Events with Facebook Pixel, please do let us know.
Can I use my Google Analytics Universal Code?
Of course. You can also use your Google Analytics Universal Code until the sunset day which was announced by Google and has been set to July 1, 2023.