Title: Tracking Different Forms
Last modified: April 13, 2017

---

# Tracking Different Forms

 *  [alexloganlee](https://wordpress.org/support/users/alexloganlee/)
 * (@alexloganlee)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/tracking-different-forms/)
 * I am running Facebook ad to get mailing list sign ups. I am using the following
   code to track conversion. However, my contact form is also using Contact Form
   7. That makes my Facebook ads reporting for mailing list sign ups not accurate.
   How can I solve this?
 * I need the eventlistener to not fire if the form is the contact form. I only 
   have 3 contact forms site wide but the mailing list sign up appears in a lot 
   of places, especially the footer.
 *     ```
       <script>
       document.addEventListener( 'wpcf7mailsent', function( event ) {
           fbq('track', 'Lead');
       }, false );
       </script>
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/tracking-different-forms/#post-9026492)
 * See [https://contactform7.com/dom-events/](https://contactform7.com/dom-events/)
 * You can set a narrower event target.
 *  Thread Starter [alexloganlee](https://wordpress.org/support/users/alexloganlee/)
 * (@alexloganlee)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/tracking-different-forms/#post-9026538)
 * Hi Takayuki,
 * I’ve actually read the page before starting this post.
 * I tried changing the querySelector to a form id but it doesn’t seem to fire.
 *     ```
       var wpcf7Elm = document.querySelector( '#wpcf7-f5976-p24-o2' );
   
       wpcf7Elm.addEventListener( 'wpcf7submit', function( event ) {
           alert( "Fire!" );
       }, false );
       ```
   
 * And it’s not quite possible for me to target all form ids. I have the 5976 form
   in the footer of every page.
    - wpcf7-f**5976**-p24-o2
    - wpcf7-f**5976**-p878-o1
    - wpcf7-f**3026**-p24-o1
 * Is it possible to target just the contact form 7 id? It would be great if you
   can provide me with an example and I can edit from there. I am not really sure
   how isolate the id for what I am trying to achieve. Thanks!
 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/tracking-different-forms/#post-9027132)
 * Can I see the site?
 *  Thread Starter [alexloganlee](https://wordpress.org/support/users/alexloganlee/)
 * (@alexloganlee)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/tracking-different-forms/#post-9032508)
 * Hi Takayuki,
 * There are 2 type of forms I am using for my website, contact form and sign up
   form.
    The landing page for my campaign is: [http://basicmodels.com.sg/be-a-model](http://basicmodels.com.sg/be-a-model)
   It contains 2 sign up forms, 1 on top and another in the footer.
 * I would like to implement site wide tracking for my campaign. The contact form
   on the homepage and contact us page will affect the tracking as it uses the same
   DOM as the sign up form. The sign up form in the footer is site wide.
 * Homepage: [http://basicmodels.com.sg](http://basicmodels.com.sg)
    Contact us:
   [http://basicmodels.com.sg/contact-us](http://basicmodels.com.sg/contact-us)
 * Thanks,
    Alex
 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/tracking-different-forms/#post-9033930)
 * Then place the sign up form inside `<div class="signupform">` `</div>` and give`'.
   signupform'` as the `querySelector()` parameter.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Tracking Different Forms’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/tracking-different-forms/#post-9033930)
 * Status: not resolved