Reporting Analytics Events when submitting a custom form

Hello!
In the past Analytics used to automatically record an event when a lead was collected using a pre defined WIX contact form element.
Now that i have composed my custom contact form, it does not longer do that - how do i associate a google analytics event to a wix custom contact form submission?

Note: the Google analytics integration to the site works well.

Hi,

From what I understood you want to send an Event to your Google Analytics Account once there has been a form submission.

There are multiple ways to achieve this. I will tell you the one which I believe is the simplest and foolproof.

First of all you need to have Google Tag Manager setup, if you don’t have it then its pretty easy. You head over here and create a new account.

Add your website name and select ’ Web ’ as shown below

Then you will get your container code from which you need to copy the code starting with GTM as highlighted below

Go over to your ’ Tracking & Analytics ’ on your Dashboard and enter the code there

This makes your Tag Manager ready to register events

Now we proceed with creating the event. This will depend on your own scenario.

I have a custom form which submits user input to a database with wixData.insert after which I redirect the user to a success page.

So I have an event firing every time someone lands on my success page. For that first I have to create a trigger in my Google Tag Manager.

Go to the ’ Triggers ’ tab on your left and create a new trigger. Name the trigger ’ Success - Pageview

Set the trigger type to ’ Page View ’ and set firing criteria to ’ Some Page Views ’ like shown below.

From the dropdown select the ’ Page Path ’ option like I do in the gif below and criteria as ’ equals

If your success page url is https://www.mywebsitename.com/success then enter /success in the Page Path.

After this you need to create a Google Analytics Variable so retrieve your GA Tracking ID then go to ’ Variables ’ and create a new User-Defined Variable.

Name it something like ’ Google Analytics ID

Select the variable configuration to be ’ Google Analytics Settings

Enter your tracking ID and save it

After this head over to ’ Tags ’ tab on your left and create a new tag. Name the Tag ’ Form Submission ’ and select ’ Google Analytics - Universal Analytics ’ in the Tag Configuration.

Set the Track Type to be ’ Event

Fill in the Category , Action and Label to whatever you want as this will be the value that will show up on your Analytics Account… Example: ’ Form Submission

Set the Google Analytics Variable that we made before under ’ Google Analytics Setting ’ and select the ’ Success - Pageview ’ under Triggering

Publish your work and it should work now.

You can use the preview and debug mode to see whether the Tag is firing on each page view or not

You can create an event for a button click too but I prefer page path to button click because in the event when the form data submission fails after the button click, GTM will still register an event which may lead to misleading analytical values.

Good luck.

Thank you! can this work without google tag manager? (aka directly with google analytics?
Does wix not support it without custom code as it does when the WIX form is used?

You can. See here How to Use Wix Code with Marketing Tools to Create Custom Events - YouTube

@shantanukumar847 I have followed the tutorial and I get no events in Google Analytics, do you have any idea where have I gone wrong?

Hi, I am working on a site that does not use a thank you page after the form is submitted. I need a form submission event for conversion tracking in Google Ads

What’s the best way to set this up?