Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #890961

    Hi Forum,

    I have been reading a lot of threads about how to add a Google event to the “send” button of my enfold contact form.

    I am using Google’s latest GA universal, thus I need to use ga send instead of the older gaq_push.

    Thus, I have been trying to add the event through the child theme’s functions.php with this:

    function add_custom_script(){
    ?><script>
    (function($){
    $(window).load(function() {
    $(‘.kontaktformular-senden a’).on(‘click’, function() {
    ga('send', 'event', 'kontakt', 'Kontaktformular', 'Senden Button');
    });
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Thankful for any idea!

    #891839

    Hey djabsolut,
    Please check your code for curly quotes:

    $(‘.kontaktformular-senden a’).on(‘click’, function() {
    $('.kontaktformular-senden a').on('click', function() {

    If that doesn’t help, try targeting the button via the target of it
    Also try clearing any cache plugin.

    Best regards,
    Mike

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.