I have set up a form through contact form 7 in a website. I have added Google analytics tracking code to set up a event goal on form submission. The event seems to get monitored on real time basics as in every form submission is triggering a event under the events tab. But the data seems to not get recorded as a goal under the conversion tab. Can someone find a solution to this.
I have used the following tracking code:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore (a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
analytics.com/analytics.js','ga');
ga('create', 'UA-18282623-2', 'auto');
ga('send', 'pageview');
</script>
and have set this code under the additional setting bar of contact form 7 to trigger the goal event:
on_sent_ok: "ga('send', 'event', 'contact-form', 'click', 'submit form',1);"
where I have set
contact-form = Category
Action = click
Label = submit form
Value = 1
I have also tried with this code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18282623-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
along with:
on_sent_ok: "_gaq.push(['_trackEvent', 'contact-form', 'click', 'submit form']);"
Nothing seems to work. Please help
Your goal configuration includes a value greater than 1, but your event is sending a value exactly equal to 1. You will either need to adjust your goal configuration to convert when the value is equal to one or send a value for your event greater than one.