使用正确的代码更新:
<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。代码“vm.fbq.push('track', 'Even Name goes here', {value: 1.00, currency: 'USD'});” 一旦有人点击订阅按钮就不会触发。我已经尝试了一切,但没有运气。有谁知道一旦有人单击按钮后如何从 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>