This is a Step by Step Guide to implementing goal tracking with Contact Form 7.
Step 1: Configure Contact Form 7
Once you have Contact Form 7 installed and have created a form to suit your needs, you will be ready to add the tracking code. To do this you need to access the specific form you want to track by going into the Contact Form 7 dashboard and selecting the form. You should then see a tab called ‘Additional Settings’. Click the tab and you will be shown an empty text box which is where you need to enter the tracking code.
Now the next step is to think of a tracking URL to suit your form. If you are only using one contact form, this won’t really be an issue but if you have several for various different purposes you may want to separate the tracking URL.
For a standard enquiry, I would have something like this: www.example.com/goal/enquiry/
Now that we have our URL, it’s time to add it to the tracking code:
Universal Analytics Code
on_sent_ok: "ga('send', 'pageview', '/goals/enquiry/');"
Some people have reported issues with the sent notification not appearing when using the code above, so you may want to try this:
on_sent_ok:”_gaq.push(['_trackPageview', '/goals/enquiry/', 'sent']);”
Step 2: How to create a Goal in Analytics
Now that you have added your tracking code to the contact form of your choice, we now need to tell Google Analytics that any requests for that URL should be classed as goals.
- Sign in to Google Analytics.
- Select the Admin tab and navigate to the desired account, property and view.
- In the VIEW column, click Goals.
- Click NEW GOAL
- You then need to give the goal a name and then select destination as the type.
- You then need to add your URL (/goals/enquiry/) into the destination field.