Support » Plugin: Caldera Forms - More Than Contact Forms » Custom Google Analytics Event not working

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Josh Pollock

    (@shelob9)

    @miguel

    Thanks for using Caldera Forms. I’d love to help. If you can please open a support ticket, with the full debug information from you site and a list of PHP and JavaScript errors you have — there is information on how to best collect these on our support page — I’d be happy to help.

    https://CalderaWP.com/support

    Thread Starter Miguel Braga

    (@miguelbraga)

    Thanks Josh.

    I have registered on the site but I am not allowed to submit a ticket. I have the free version. Isn’t there another way to help me?

    Thanks!

    Plugin Author Josh Pollock

    (@shelob9)

    Miguel – We do not offer free support for Caldera Forms. You must purchase an add-on, bundle or priority support plan to receive support.

    Thread Starter Miguel Braga

    (@miguelbraga)

    I figured out what was happening.
    The problem was that I was using the Google Analytics by MonsterInsights that renames the ga object to __gaTracker. This issue is not your fault indeed but I bet that a lot of your users will experience it. I suggest you update your Google Analytics article to further help your users.

    Hi @miguelbraga. Can you please explain what you did to make it work? You only said what the problem was, but you didn’t show your solution. I have exactly the same problem, but I don’t know how to fix it. Thank you so much! 🙂

    Thread Starter Miguel Braga

    (@miguelbraga)

    Hi zviera.
    I assumed it was evident. 😛 If you’re using Google Analytics by MonsterInsights the solution is to rename the “ga” object to “__gaTracker” in the function provided in the “Send A Custom Google Analytics Event On Form Submission” article.
    Please, tell me if it worked. 😉

    Thanks @miguelbraga! It was not evident to me, but yes, it works now!

    For others, who are not that familiar with code, this is the complete function:

    
    function slug_post_form_submission( obj ) {
        var entry_id = obj.data.cf_id;
        __gaTracker('send', {
            'hitType': 'event',          // Required.
            'eventCategory': 'form',   // Required.
            'eventAction': 'click',      // Required.
            'eventLabel': 'Form Submission',
            'eventValue': entry_id
        });
    }
    

    Now I just wonder whether there are some variables we can use to send the form name or url address for example, so that when I have more forms, I can see which form was submited. Is this possible, @shelob9?

    Thanks.

    PS: Nice profile photo, Miguel! 😀

    Thread Starter Miguel Braga

    (@miguelbraga)

    I will answer this for Josh. Hope he doesn’t mind.
    You can use the obj.form_id property as described in the “See example” link.
    I am a really nice guy so I give you the full code:

    function slug_post_form_submission( obj ) {
        var form_id = obj.form_id;
        __gaTracker('send', {
            'hitType': 'event',          // Required.
            'eventCategory': 'form',   // Required.
            'eventAction': 'click',      // Required.
            'eventLabel': 'Form Submission ID ' + form_id
        });
    }

    You could easily replace “obj.form_id” with “obj.form_name” to get the name instead of the ID (please don’t make me paste the entire functions again 😀 )
    As you can see, I have ditched the “eventValue”. On GA this represents an amount (e.g. a price) and it will sum up all events values in the end. It makes no sense to track the entry ID there. I don’t even know what kind of metric can I get with it.

    PS: You are quite handsome in your profile photo too. 😛

    Thanks a lot, Miguel! It’s exactly what I wanted.

    And yes, the eventValue was pretty much useless in this case.

    PS: Haha. I meant especially the shape of your photo which is similar to mine. Bud thanks! 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom Google Analytics Event not working’ is closed to new replies.