javascript - 无法在 Google Analytics 上设置不同的标题

标签 javascript html css google-analytics head

我正在尝试设置不同页面的标题。我将该代码放在页面的头部:

<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-XXXXXXX-Y');
    ga('send', 'pageview');
    ga('set', 'title', 'Invitation');
</script>

我想将“标题”设置为“邀请”,但我没有收到 Google Analytic 方面的反馈。显然我把 UA-XXXXXXX-Y 改成了我的个人代码。 现在我只能看到该页面已被访问,但它具有页面的默认标题而不是被覆盖的标题。

最佳答案

发送综合浏览量时,将标题作为附加和可选参数传递。

ga('send', 'pageview', {
    title: 'Invitation'
});

关于 page tracking on google developers 有更多信息.

关于javascript - 无法在 Google Analytics 上设置不同的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19412189/

相关文章:

php - 图像未上传到mysql数据库php

jquery - 在 WordPress 中滚动时更改导航菜单背景颜色

jquery - 在 IE7 中为 jquery ganttView 使用 css

javascript - 如何根据条件实例化 ng-controller

html - 文本对齐不适用于同一行

javascript - 将 Json 数据绑定(bind)到 HTML TABLE

jquery - CSS/Jquery 时间轴/调度程序显示

javascript - 我需要显示一条折线,其中包含从数据库动态获取的一组点,精确地捕捉到道路

javascript - fadeIn 使用 $(document).ready( ) 导致明显的滞后

javascript - 在 sencha touch 2 中使用 oAuth 连接 facebook