-
AuthorPosts
-
March 1, 2019 at 8:47 pm #1073377
Hu,
We must insert a code like this:
<form action=”URL” method=”post” onsubmit=”gtag(‘event’, ‘Envío solicitud de contacto’, { ‘event_category’: ‘contactar’, ‘event_action’: ‘Botón enviar’});”>
in the form label of contact form.
Please, can anyone tell me where can insert this?
Thanks!
March 4, 2019 at 11:02 am #1074281Hey toniface,
You’ll need to tweak it in the parent theme, which means you’ll need to do this after doing a theme update.
Edit wp-content > themes > enfold > framework > php > class-form-generator.php and find this code (line 140):$this->output = '<form action="'.$params['action'].'" method="post" '.$form_data.' class="'.$form_class.' '.$extraClass.'" data-avia-form-id="'.$this->formID.'" '.$redirect.'><fieldset>';
Hope it helps.
Best regards,
NikkoMarch 6, 2019 at 8:26 pm #1075605Dear Nikko,
Sorry, I’m really bad for php… I saw the php line you said me
I need insert this line:
<form action=”URL” method=”post” onsubmit=”gtag(‘event’, ‘Envío solicitud de contacto’, { ‘event_category’: ‘contactar’, ‘event_action’: ‘Botón enviar’});”>
How can we do thi? Replace the line you said?Thanks
March 7, 2019 at 5:47 am #1075754Hi toniface,
Try replacing it with this code:
$this->output = '<form action="'.$params['action'].'" method="post" onsubmit="gtag(\'event\', \'Envío solicitud de contacto\', { \'event_category\': \'contactar\', \'event_action\': \'Botón enviar\'});" '.$form_data.' class="'.$form_class.' '.$extraClass.'" data-avia-form-id="'.$this->formID.'" '.$redirect.'><fieldset>';
Hope it helps.
Best regards,
NikkoApril 2, 2019 at 11:04 am #1086022Dear Nikko,
I’ve tried but it doesn’t work. Any other possibility?
The Enfold documenttion say this:
What’s the good one?
Thanks!
April 4, 2019 at 12:42 am #1086695Hi,
That filter is use to add an attribute to the form submit button.
Did you set an event goal?
// https://support.google.com/analytics/answer/1032415?hl=en
Make sure that you’re using the correct ga library. Are you using this snippet?
// https://developers.google.com/analytics/devguides/collection/analyticsjs/
If so, you have to use the ga function instead of gtag.
// https://developers.google.com/analytics/devguides/collection/analyticsjs/events
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.