-
AuthorPosts
-
August 2, 2017 at 6:36 pm #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
August 2, 2017 at 6:40 pm #833589I 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 websiteAugust 7, 2017 at 2:21 pm #835379Hi,
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,
YigitAugust 8, 2017 at 3:21 am #835662Is 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
August 9, 2017 at 12:23 pm #836334Hi 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, 4 months ago by Victoria.
-
AuthorPosts
- You must be logged in to reply to this topic.