• Resolved gerrooo

    (@gerrooo)


    Hey Team!

    Using the code from: https://ww.wp.xz.cn/support/topic/google-tag-manager-35/
    I was able to implement Tracking – however, this only works with Ajax enabled. When I enable Ajax submission, the contact forms breaks: Error collecting API response.
    So what I did is to exclude the following files from minify:
    yikes-inc-easy-mailchimp-extender/public/js/form-submission-helpers.min.js
    yikes-inc-easy-mailchimp-extender/public/js/yikes-datepicker-scripts.min.js
    yikes-inc-easy-mailchimp-extender/public/js/yikes-mc-ajax-forms.min.js

    However, it still does not work. So, before I need to keep on checking on how to solve the API error, is there any way to implement Analytics/Tagmanager tracking without using Ajax submission?

    Thank you in advance!

    Kind regards,

    Gerardo

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi Gerardo,

    You need to use AJAX for submission tracking. If you send me the URL to your form though I should be able to diagnose the “Error collecting API response” issue. This is usually due to broken a JavaScript function.

    Thank you,
    Kevin.

    Thread Starter gerrooo

    (@gerrooo)

    Hey Kevin,

    Thank you for your support.

    I made a testpage for this issue: https://bit.ly/2RCLsWY
    Please note: The problem is not in the pop-up on the right, but on the page itself.

    Regards,

    Gerardo

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi Gerardo,

    This is quite bizarre. The AJAX call is immediately returning an HTTP 302 code and returning your website’s homepage as a redirect URL. I don’t think I’ve seen this behavior before. It’s almost like AJAX is purposely disabled on your site.

    Do you have other forms that run AJAX calls? Have you had issues with AJAX before? Are you using a plugin that could be disabling AJAX?

    Also, can you try excluding the aforementioned JS files from the minification?

    Thank you,
    Kevin.

    Thread Starter gerrooo

    (@gerrooo)

    Hey Kevin,

    Thanks a lot!

    I just found this function in my functions.php:
    function no_mo_dashboard() {
    if (!current_user_can(‘manage_options’) && $_SERVER[‘DOING_AJAX’] != ‘/wp-admin/admin-ajax.php’) {
    wp_redirect(home_url()); exit;
    }

    and changed that to:
    function no_mo_dashboard() {
    if (!current_user_can(‘manage_options’ ) && !(defined(‘DOING_AJAX’) && DOING_AJAX)) {
    wp_redirect(home_url()); exit;
    }
    }

    Now everything works 🙂

    Regards,

    Gerardo

    • This reply was modified 7 years, 8 months ago by gerrooo.
    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Woohoo! Nice find, Gerardo!

    Glad it’s working. Have a nice day.

    Cheers,
    Kevin.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Analytics Tracking without Ajax’ is closed to new replies.