Increase revenue from Joomla Websites

Analytics for Joomla provides resources to optimize and get insights for Joomla websites without knowledge of HTML

Tracking Joomla contact forms in Google Analytics

Tracking Joomla contact forms in Google Analytics 4.0 out of 5 based on 1 votes.

Event tracking

Most Joomla website have a contact form to make sure that visitors of the website can get in touch with them easily. Joomla has a standard contact form which you can use. You can even set up multiple contact forms with the Joomla component. This makes it easy to let visitors contact specific departments of your company. We have developed an easy way to track form submissions with event tracking in Google Analytics, differentiating submission of different contact forms.

To use this instruction, you will need to use the standard comment form provided by a new installation of Joomla. You will also need access to the files of your Joomla website (preferably by FTP). We have focused our instruction on the latest version of Joomla 1.5 (v1.5.23). Instructions may vary on different versions of the component.

1. Finding the right file to edit in Joomla

You will need to find the template of the form that posts comments. The file is called 'default.php'.

You can find the file in this folder of your Joomla website: '/components/com_contact/views/contact/tmpl'.

2. Editing the file to track submitted form in Google Analytics

In line 20 of the file you will find this code:

<form action="<?php echo JRoute::_('index.php') ?>" method="post" name="selectForm" id="selectForm">

You will have to replace this line of code with:

<form action="<?php echo JRoute::_('index.php') ?>" method="post" name="selectForm" id="selectForm" onSubmit="_gaq.push(['_trackEvent', 'contact-form', 'submit', '<?php echo JText::_( 'Select Contact' ); ?>']);">

Once you have made this change, you can save it and upload the new version of the file.

3. Finding Joomla contact form submissions in Google Analytics

You can now find the contact form submissions in your Google Analytics profile. They will be located in the contact-form category of your even tracking report.

event tracking in Google Analytics

Share your comments