使用GTM创建自定义指标 [英] Creating custom metric with GTM

查看:115
本文介绍了使用GTM创建自定义指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 GTM V2的新手.

我想使用自定义指标来跟踪PDF下载.我可以为其创建自定义维度,但无法创建自定义指标.

I would like to track PDF downloads using custom metric. I can built custom dimension for the same, but am not able to create custom metric.

我想要报告类似于以下内容:

I want report similar to below:

PDFname        no. of download
xyx                   1
abc                   5

  • xyz pdf下载1次abc 5
  • PDF名称和编号下载次数为列标题,其余为值
  • 我想使用GTM v2创建指标.我不想用相同的方式编写JavaScript.我已经使用事件跟踪完成了上述报告,但希望对自定义指标进行同样的操作

    I want to create metric using GTM v2. I don't want to write JavaScript for the same. I have done above report using event tracking, but want to do the same with custom metric

    请详细说明如何使用GTM创建自定义指标.

    Please explain in detail on how to create custom metric, using GTM.

    请尽快帮助我.

    推荐答案

    在新版本的Google跟踪代码管理器中,宏"已重命名为变量",因此我将这样称呼它们.

    In the new version of Google Tag Manager, 'Macros' have been renamed to 'Variables' so I will be referring to them as such.

    我实现了一个标签,该标签可以跟踪何时在我的网站上下载PDF.我是通过创建自定义变量来实现的.请按照以下步骤创建跟踪PDF下载所需的变量.

    I implemented a tag which tracks when a PDF is downloaded on my website. I did this by creating a custom Variable. Follow the steps to create the variables required to track PDF downloads.

    1)创建一个名为"element"的新变量,将此变量设置为"auto-event"变量.从变量类型"下拉菜单中选择元素".点击保存变量"

    1) Create a new variable called 'element', make this variable an 'auto-event' variable. Select 'Element' from the Variable Type drop-down menu. Click 'Save Variable'

    2)创建一个名为点击链接文件名"的新变量.将此变量设置为自定义Javascript变量.将以下代码插入配置变量字段.

    2) Create a new variable called 'Click Link File Name'. Make this variable a Custom Javascript Variable. Insert the following code into the configure variable field.

    function() {
        var filepath = {{element}}.pathname.split("/");
        var filename = filepath.pop();
        return filename.indexOf(".")>-1?filename:'n/a';
    }
    

    点击保存变量"

    3)创建触发器-将触发器命名为"PDF下载"

    3) Create the Trigger - Name the Trigger "PDF Download"

    • 事件:点击
    • 配置:仅链接
    • 启用时间:[页面URL] [匹配RegEx].*
    • FireOn:[点击URL路径] [匹配RegEx].(pdf)$

    4)创建标签

    • 产品:Google Analytics(分析)
    • 代码类型:通用分析
    • 配置标签:
      • 跟踪ID:您的跟踪代码在这里"
      • 跟踪类型:事件"
      • 类别:点击"
      • 操作:下载"
      • 标签:"{{点击链接文件名}}"
      • Product : Google Analytics
      • Tag Type : Universal Analytics
      • Configure Tag:
        • Tracking Id : "Your Tracking Code Here"
        • Track Type : "Event"
        • Category : "Click"
        • Action : "Download"
        • Label : "{{Click Link File Name}}"

        这组说明将为您提供的功能是设置一些变量,这些变量能够记录PDF文件的名称以及作为事件进行跟踪的能力.我们在第3步中设置的触发器会告诉GTM,当用户点击以字符串".pdf"结尾的链接时,GTM会激活每个页面(.*)上的标签,并触发标签.我们设置的代码告诉GTM将事件与上面列出的类别,操作和标签一起发送到您的Google Analytics(分析)帐户.事件的标签将包含已下载的PDF文件的名称.

        What this set of instructions will do for you is set up variables able to record the name of your PDF file as well as the ability to track it as an event. The trigger that we set up in step 3 tells GTM to ACTIVATE the tag on every page (.*) and FIRE the tag when the user CLICKS a link ending with the string ".pdf". The tag we set up tells GTM to send an event to your GA Account with the category, action and label listed above. The label of the event will contain the name of the PDF file that was downloaded.

        如果您要进行更多自定义,请告诉我,我将为您提供解决方案,以跟踪诸如 -PDF是从哪个页面下载的

        If you want any more customization than this let me know and I will provide you with a solution to track things like - Which page the PDF was downloaded from

        这篇关于使用GTM创建自定义指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆