联系表格 7 (WordPress) 不会触发 FB 事件
我编写的代码适合Contact Form 7 自定义 DOM 事件所需的内容
document.addEventListener( 'wpcf7submit', function( event ) {
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '18015239334xxxxx[![enter image description here][1]][1]');
fbq('track', 'lead_sent');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=18015239334xxxx&ev=lead_sent&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
}, false );