我想将FB的跟踪代码添加到我的VueJS LandingPage。
但是我不确定我必须在哪里放置代码片段?
<!-- 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', 'xxxxxx');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1"
src="https://www.facebook.com/tr?id=xxxxxx&ev=PageView
&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->
如果我自己将此代码复制到index.html,它将起作用。但是我必须将要复制到我的index.html版本中的代码片段放在哪里?
如果使用Vue CLI 3,则应具有src
文件夹和public
文件夹。 public
文件夹包含index.html
,该文件用于生成构建后在dist文件夹中看到的index.html文件。只需在其中添加您的跟踪器,它也应包含在您的内置版本中。
并且怎么知道,像素应该只在表单向导的第三页上被触发?