Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #833586

    Hi Support Team,
    I just inserted Facebook’s Pixel to theme’s <head> and now I’m trying to add an action in functions.php which tells to Facebook that there was a conversion right after a user subscribed to a form (via Enfold’s Mailchimp integration).

    I assume the code would be like that:

    add_action( 'wp_footer', function(){
        ?>
        <script type="text/javascript">
            #######HERE I NEED TO PLACE THE "SUBSCRIBED" FUNCTION OF MAILCHIMP######### {
                fbq && fbq('track', 'Lead');
            });
        </script>
        <?php
    });

    Thanks in advance for the help

    #833589

    I know that I can make that work by putting

    <script>
    fbq('track', 'Lead');
    </script>
    

    right after the “thank you message” on Enfold’s Mailchimp page integration. But I should to that with EVERY form in my website.
    If it’s possible I’d like to create a global rule that set’s the code on every mailchimp form inside my website

    #835379

    Hi,

    Please go to Enfold theme options > Layout Builder and check “Show element options for developers” and then edit your Mailchimp signup button and give it a custom CSS class and then add following code to Functions.php file in appearance > Editor

    function av_mc_onclick(){
    ?>
     <script>
    jQuery(window).load(function(){
    jQuery('.your-custom-class .button').attr('onClick','HERE GOES YOUR ONCLICK EVENT');
    });
     </script>
    <?php
    }
    add_action('wp_footer', 'av_mc_onclick');

    Best regards,
    Yigit

    #835662

    Is it possible to add a double onlick event? For example if I’d like to add Analytics Conversion and Facebook Conversion at the same time

    #836334

    Hi Halo,

    You can several things executed in you event handler function, those can be calls to both of those analytics tracking functions.

    
    function av_mc_onclick(){
     ?>
    <script>
    
    jQuery(window).load(function(){ 
        jQuery ('.your-custom-class .button').attr('onClick', track); 
    });
    function track(event) {
    //track fb
    //track other stuff here
    }
    </script>
    <?php
    } add_action('wp_footer', 'av_mc_onclick');
    
    

    Best regards,
    Victoria

    • This reply was modified 7 years, 3 months ago by Victoria.
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.