我试图在单击按钮时跟踪呼叫电话事件。我的 GA 代码是从设置向导中提供的。
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{site.google_analytics_tracking_id}}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{site.google_analytics_tracking_id}}');
</script>
我的按钮代码是:
<!-- Banner -->
<section id="banner">
<div class="inner">
<header>
<h2>{{ site.title }}</h2>
<figure>
<picture class="image logo">
<span class="icon logo fa-balance-scale"></span>
</picture>
<figcaption><small>Serving: {{ site.location }}</small></figcaption>
</figure>
</header>
<p><strong>We Work Hard To Protect Your Rights!</strong></p>
<footer>
<ul class="buttons stacked">
<button class="button fit">Call: <a href="tel:{{site.tel}}" onClick=”ga('send', 'event', 'Calls', 'clicked', 'Contact Office', 1);”>{{site.tel}}</a></button>
</ul>
</footer>
</div>
</section>
投票
请对问题投赞成票或反对票。在否决投票之前,建议编辑或发表评论?
墨色风雨
相关分类