', 'get("parent-url","home"); ?>');} Then in form display section I added data-gvalidate_success:ga_track_eventto the form tag attributes boxAll code is loaded in front-end, just de ga_track_event function doesn't get fired.Please help, regards,Mark"> Google Analytics Tracking in CFv6 - Forums

Forums

Google Analytics Tracking in CFv6

pinkeltje77 27 Jul, 2017
Hi,

I am trying to get GA event tracking enabled in CFv6. In the forums I see the use of data-gvalidate_success but when implemented it doesnt track anything inside GA.

I use following JS in Javascript custom code block:
function ga_track_event(event, form){
 console.log('tracking fired');
  ga('send', 'event', 'verzend-contact-formulier', '<?php echo $this->get("pagesection","home"); ?>', '<?php echo $this->get("parent-url","home"); ?>');
} 


Then in form display section I added
data-gvalidate_success:ga_track_event
to the form tag attributes box

All code is loaded in front-end, just de ga_track_event function doesn't get fired.

Please help, regards,
Mark
pinkeltje77 27 Jul, 2017
That does not help, I followed that but its not working.
pinkeltje77 03 Aug, 2017
Really no one can help me with this?
Max_admin 09 Aug, 2017
Hi pinkeltje77,

Apologies, I did not see this earlier!

Did you try just placing the code inside <script> and </script> tags inside a "Custom code" action in the form "submit" event ?

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
healyhatman 01 Mar, 2018
2 Likes
For the form itself, go to your setup tab and under "load" -> "Display section", under "Form tag attributes" you can put in
onSubmit:ga('send','event','contactForm','submitContactForm');
Obviously, replace contactForm and submitContactForm with whatever category and event name you want.
​
For buttons, under your Designer tab, go Advanced and put the code in the Extra Attributes field.
onClick:ga('send','event','contactForm','clear');
​
Please note the -> : <- separating the two parts of the attribute., as opposed to an equals sign.
​
I have just done this and verified that my event is correctly fired and sent to GA.
This topic is locked and no more replies can be posted.