我有这个代码, 我不断收到主题中的错误。
我自己没有编写此代码,但是从网站上复制它,并且它假设从流量来源创建参数。
<script type="text/javascript">
if (localStorage.getItem('firstSource') == null)
{
var firstSource;
if ({{Page URL}}.indexOf("gclid") > -1)
{
firstSource = "AdWords"
console.log('adwords');
}
else
if ({{utm_source param}} != undefined)
{
firstSource = "{{utm_source param}} / {{utm_medium param}}"
console.log({{utm_source param}} + "utm");
}
else
if ( ({{Referrer}}.indexOf('google') > -1) || ({{Referrer}}.indexOf('bing') > -1))
{
firstSource = "{{Referrer}}"
console.log('organic');
}
else
if ( {{Referrer}} !== ")
{
firstSource = {{Referrer}}
console.log('referrer');
}
else
if ({{Referrer}} == ")
{
firstSource = "direct";
console.log('direct');
}
localStorage.setItem('source',firstSource);
dataLayer.push({'event':'setTheFirstSource','firstSource':firstSource});
}
</script>
请告知
答案 0 :(得分:0)
其他阻止是问题所在。如果有多行,则其他块应位于花括号内。