-
AuthorPosts
-
February 21, 2019 at 10:26 am #1069854
Hello,
i want to track different conversions on my webite.
how can i track that a user sends me a contact form?I have different contact forms and i want to create for each contact form an own conversion tracking?
As contact form i use the integrated contact form from avia layout architect.
Whats the best way for tracking and how does it work?
February 22, 2019 at 8:22 am #1070254Who can help me?
February 22, 2019 at 3:35 pm #1070363nobody can help me??
February 23, 2019 at 10:53 am #1070645Hi,
Thank you for contacting us.
This is not a theme related issue but we can sure point you in the right direction. Please refer to this link for more information.
Best regards,
VinayFebruary 25, 2019 at 10:44 am #1071200I put this Code in my child theme function
add_filter('avf_contact_form_submit_button_attr','avia_add_submit_attributes_to_cf', 10, 3); function avia_add_submit_attributes_to_cf($att, $formID, $form_params){ $att = "onclick=\"var _gaq = _gaq || [];_gaq.push(['_trackEvent', 'Anfrage', 'Senden', 'Anfragesenden', testvalue, true]);\""; return $att; }
And i create a goal in analytics with this parameters:
Event:
https://www.bilder-upload.eu/bild-0b89c1-1551084192.jpg.htmlThe tracking doesn’t work in analytics.
I send a contact form but the counter doesn’t spring to “1” on 25.02.2019.
Why?February 28, 2019 at 5:18 am #1072472Hi,
(index):243 Uncaught ReferenceError: testvalue is not defined
at HTMLInputElement.onclick ((index):243)That is an error from the console. The “testvalue” variable is not defined or it doesn’t exist, and you need to make sure that the goal value is an integer.
'Anfragesenden', testvalue, true]);\"";
should be:
'Anfragesenden', 1, true]);\"";
// https://support.google.com/analytics/answer/1033068
Best regards,
IsmaelFebruary 28, 2019 at 9:37 am #1072552Ok i pasted that code snippet in my child theme but the Counter doesn t Jump to 1 after senden a form. 😕
March 1, 2019 at 4:51 am #1072859Hi,
Looks like you’re using the Google Tag Manager instead of analytics library.
// https://developers.google.com/analytics/devguides/collection/gtagjs/
<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'GA_TRACKING_ID'); </script>
You have to replace it with the analytics library snippet.
// https://developers.google.com/analytics/devguides/collection/analyticsjs/
And replace gaq function with ga.
// https://developers.google.com/analytics/devguides/collection/analyticsjs/events
Related thread: https://kriesi.at/support/topic/google-analytics-and-yandex-metrika-goals-for-tracking-contact-form-in-child-the/#post-1063872
Best regards,
IsmaelMarch 3, 2019 at 9:04 pm #1074033i am sorry but it did not work…=/
please check my code in private content box i put in the options of: ENFOLD – Google DiensteMarch 5, 2019 at 4:07 am #1074618Hi,
Thanks for the update.
The “ga” function should replace “gaq” in the button filter.
$att = "onclick=\"ga('send', 'event', '_trackEvent', 'Anfrage', 'Senden', 'Anfragesenden', 1, true);\"";
Best regards,
IsmaelMarch 5, 2019 at 11:32 am #1074789it doesn’t work =/
don t know what i am doing wrong.March 6, 2019 at 5:16 am #1075256Hi,
I was referring to this filter.
add_filter('avf_contact_form_submit_button_attr','avia_add_submit_attributes_to_cf', 10, 3); function avia_add_submit_attributes_to_cf($att, $formID, $form_params){ $att = "onclick=\"var _gaq = _gaq || [];_gaq.push(['_trackEvent', 'Anfrage', 'Senden', 'Anfragesenden', testvalue, true]);\""; return $att; }
You have to replace the gaq function with ga like so..
add_filter('avf_contact_form_submit_button_attr','avia_add_submit_attributes_to_cf', 10, 3); function avia_add_submit_attributes_to_cf($att, $formID, $form_params){ $att = "onclick=\"ga('send', 'event', '_trackEvent', 'Anfrage', 'Senden', 'Anfragesenden', 1, true);\""; return $att; }
Best regards,
IsmaelMarch 6, 2019 at 9:01 am #1075396i put your code in the functions-enfold.php but the analytics counter does’t jump to 1 if i send a formular.
please see pics in private content.March 8, 2019 at 9:09 am #1076265@Ismael Do you know what i am doing wrong?
March 8, 2019 at 12:44 pm #1076336Hi,
This data is being transmitted when you click on the submit button, so the ga function is working properly. (see private field)
You may need to wait for a while to see the results in your google console. If you don’t see anything, it’s possible that something is wrong with your goal configuration or they don’t coincide with the onclick handler that we created. Unfortunately, we won’t be able to check that without logging in to your gmail account.Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.