Unable to track form Signup and Success
-
Hi.
I am using MailChimp for WP to create a form on my website:
It works great and I am able to collect signups.
My problem is that I would like to track form successes and/or signups.
I am able to track form errors and starts following the documentation from these articles:
https://kb.mc4wp.com/javascript-form-events/
https://kb.mc4wp.com/form-events-google-analytics-tracking/However no event seems to fire on a success.
This is my form code:
<h2> Bliv alfa-tester </h2> <div class="input-icon-wrapper"> <div class="input-icon"> <i class="fa fa-user" aria-hidden="true"></i> </div> <input type="text" name="NAME" placeholder="navn" required> <!--<span class="help-tip">Vi vil gerne l?re dig at kende.</span>--> </div> <div class="input-icon-wrapper"> <div class="input-icon"> <i class="fa fa-envelope" aria-hidden="true"></i> </div> <input type="email" name="EMAIL" placeholder="e-mail" required /> <!--<span class="help-tip">Vi vil gerne l?re dig at kende.</span>--> </div> <div class="input-icon-wrapper"> <div class="input-icon"> <i class="fa fa-building" aria-hidden="true"></i> </div> <input type="text" name="WEBSITE" placeholder="website" required> <!--<span class="help-tip">Vi vil gerne l?re dig at kende.</span>--> </div> <div class="input-submit-wrapper"> <div class="input-submit-icon"> <i class="fa fa-arrow-right" aria-hidden="true"></i> </div> <input class="main-cta button-cta" type="submit" value="Bliv alfa-tester nu" /> </div> <script type="text/javascript"> mc4wp.forms.on('success', function(form) { dataLayer.push({'event': 'form-success', 'eventLabel': 'frontpage-hero-form' }); }); mc4wp.forms.on('started', function(form) { dataLayer.push({'event': 'form-started', 'eventLabel': 'frontpage-hero-form' }); }); mc4wp.forms.on('error', function(form) { dataLayer.push({'event': 'form-submit-error', 'eventLabel': 'frontpage-hero-form' }); }); </script> <script type="text/javascript"> mc4wp.forms.on('subscribed', function(form) { // analytics.js ga && ga('send', 'event', 'Forms', 'Sign-up', 'Name: ' + form.name + 'ID: ' + form.id); }); </script>
Thank you in advance
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Unable to track form Signup and Success’ is closed to new replies.