• Resolved Jan Mi?acky

    (@mirackygmailcom)


    Hello,
    I’m thinking about switching over to Forminator after using Contact Form 7. One thing that is a necessity for me is to be able to track form submissions in Google Analytics (as conversion goals) as events. Redirecting to a ‘Thank you’ page wouldn’t work for me.

    How can I do this?with Forminator, please?

    Thank you,
    Jan

Viewing 5 replies - 16 through 20 (of 20 total)
  • That’s awesome news Dimitris – thanks so much!

    Nevermind….

    Thread Starter Jan Mi?acky

    (@mirackygmailcom)

    Hi,
    I would like to re-open this topic. My question is whether it’s possible to use custom fields data that would get sent to Google Analytics/Facebook Pixel.

    For example this is the original code:

    if( form_id == 12345 ){
                gtag( 'event', 'Sign-up', { 'event_category': 'Tour', 'event_label': 'Prague','value': '100' } );
            }

    Can I do something like this?

    if( form_id == 12345 ){
                gtag( 'event', 'Sign-up', { 'event_category': 'Tour', 'event_label': 'acf_tour_name','value': 'acf_tour_value' } );
            }

    I’d love to be able to transmit ACF data into analytics using a single form.

    Thank you for your help.

    Best regards,
    Jan

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    HI @mirackygmailcom

    In general, it most likely would be possible to pass over custom fields data but not quite this way.

    Let’s ay that your “acf_tour_name” is “Prague” and “value” is “100”. If you pass it over like

    'event_label': 'acf_tour_name','value': 'acf_tour_value'

    in the code the result will be that in your GA/FBP you’ll see

    adv_tour_name

    and

    acf_tour_value

    strings literally, not actual values of them.

    To overcome this you’d need to “print out” values of these fields with PHP and use some ACF-core function to fetch field value so do something like that:

    'event_label': '<?php echo get_field( 'acf_tour_name' ); ?>','value': '<?php echo get_field( 'acf_tour_value' ); ?>'

    Please note: I didn’t test above code and it’s more of a general advice on what direction to follow rather than a solution. On our snippet end, the way is to print out field value with PHP but then how to get that variable it a different thing and might depend on ACF too so you might want to check ACF docs to find out more about that.

    It’s a customization that goes a bit out of the scope of our support but hoepfully this will give you some kickstart.

    Best regards,
    Adam

    Thread Starter Jan Mi?acky

    (@mirackygmailcom)

    Hi Adam,
    thank you for your reply. I tried the PHP echo function but it didn’t work. It returned (not set) in Google Analytics.

    I understand that it’s already beyond the scope of regular support. Please, consider adding this as a feature to your upcoming versions.

    Best regards,
    Jan

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Forminator and Events to track in Google Analytics’ is closed to new replies.