title: How do I fire Facebook pixel within VueJS
body: <p>UPDATE WITH CORRECT CODE:</p>
  
  <pre><code>&lt;script&gt;
          export default {
              mounted() {
      //            this.comments_data = this.comments;
              },
              props: ['type'],
              data() {
                  return {
      //                type: [],
                      email: '',
                      error_found: false,
                      email_error: '',
                      already_subscribed: '',
                      subscribed: false,
                  }
              },
              methods: {
                  subscribe(){
                      var vm = this;
                      vm.error_found = false;
                      vm.email_error = '';
                      vm.already_subscribed = '';
                      window.fbq('trackCustom', 'Custom Event Name Goes Here', {value: 1.00, currency: 'USD'});
                  },
              },
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>I'm trying to fire a FB Pixel when someone clicks on subscribe button using VueJs. Code "vm.fbq.push('track', 'Even Name goes here', {value: 1.00, currency: 'USD'});" does not fire once someone clicks on the subscribe button. I have tried everything but with no luck. Does anyone know how to fire a Facebook pixel event from VueJS once someone clicks on a button?</p>
  
  <pre><code>&lt;button @click="subscribe" class="btn btn-success btn-block"&gt;
      Submit
  &lt;/button&gt;
  </code></pre>
  
  <p>This is my VueJS Code</p>
  
  <pre><code>&lt;script&gt;
      export default {
          mounted() {
  //            this.comments_data = this.comments;
          },
          props: ['type'],
          data() {
              return {
  //                type: [],
                  email: '',
                  error_found: false,
                  email_error: '',
                  already_subscribed: '',
                  subscribed: false,
              }
          },
          methods: {
              subscribe(){
                  var vm = this;
                  vm.error_found = false;
                  vm.email_error = '';
                  vm.already_subscribed = '';
                  vm.fbq.push('track', 'Even Name goes here', {value: 1.00, currency: 'USD'});
              },
          },
      }
  &lt;/script&gt;
  </code></pre>