By making use of the __ma_formHandler_3rd as described above we can easily update WordPress forms to start creating CRM records, tracking form submissions and sending double opt-in registration emails.

 

To do this please follow steps below within WordPress:


  1. Please make a backup of your WordPress instance before starting
  2. Go to Appearance -> Editor
  3. Ensure you have selected the correct theme that needs editing
  4. Select to edit ‘Theme Footer’ (footer.php) and add the following lines in and then save it 
    1. <script src=“https://link.CompanyName.com/k.js”></script>
    2. <script ssrc=“https://link.CompanyName.com/js/ma_utils.js”></script>
  5. Go to Contact -> Contact Forms select the contact form that you wish to track.  Edit the form so that each field has an id: tag associated with it and then save it.  Make a note of the id associated to the form at the top.  For example in the form below id=”27”.
  6. Select to edit functions.php (ensure you have selected the correct theme first).  Add the following lines to the bottom of the page (before </script><?php }).  The if condition must be associated to the id of the form that you need tracking i.e. 27 in this case.  Please save the file once modified.


add_action( 'wp_footer', 'cf7events_wp_footer1' );


function cf7events_wp_footer1() {

?>
<script type="text/javascript">

  document.addEventListener( 'wpcf7mailsent', function( event ) {

     if ( '27' == event.detail.contactFormId ) {

         __ma_formHandler_3rd('Contact form', {'your-forename':'forename','your-surname':'surname','your-email':'email'},true,"yes");

     }

  }, false);

</script>
<?php
}


This is all that is required for hooking up WordPress Contact Form 7 for tracking Form Submission MA events in Kulea.