使用正确的代码进行更新:
<script>
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'});
},
},
}
</script>
当有人点击使用VueJs的订阅按钮时,我试图解雇FB Pixel。 Code&#34; vm.fbq.push(&#39; track&#39;,&#39; Even Name to here&#39;,{value:1.00,currency:&#39; USD&#39;}); &#34;一旦有人点击订阅按钮,则不会触发。我已经尝试了一切,但没有运气。有人点击按钮后,是否有人知道如何从VueJS发起Facebook像素事件?
<button @click="subscribe" class="btn btn-success btn-block">
Submit
</button>
这是我的VueJS代码
<script>
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'});
},
},
}
</script>