通过Google跟踪代码管理器访问Google Analytics设置的客户ID [英] Accessing ClientID set by Google Analytics through Google Tag Manager

查看:1379
本文介绍了通过Google跟踪代码管理器访问Google Analytics设置的客户ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已设置新的 Universal Analytics跟踪,并且喜欢将ClientID存储在其中一个自定义维度插槽中

跟踪代码是通过Google跟踪代码管理器(使用预定义的UA代码)实现的,我很难将客户端ID(通过自定义JavaScript宏)基本的网页浏览请求。



我已经命名了我的循迹器,以便我可以访问它,并且此代码在控制台中运行时没有任何错误,但是当与GTM一起使用时, 。
$ b

  ga.getByName('trackerGTM')。get('clientId'))
 未捕获的ReferenceError :ga未定义

任何提示?

解决方案

我假设您正在触发 {{url}}与RegEx。* 匹配的网页浏览,对吗?可能是Universal尚未加载。您是否尝试过 {{event}}等于gtm.dom ?我没有测试过这个,但这是一个想法。



编辑:



这看起来像一个错误。我能够运行:

  function(){
var client = ga.getAll()[0]。得到( '的clientId');
返回客户端;

}

并且让它吐出客户ID并没有问题。

I have setup a new Universal Analytics tracking and would like to store ClientID in one of the custom dimensions slots.

The tracking tags are implemented through Google Tag Manager (using the predefined UA tag) and I am having the difficulty to passing the Client ID (via custom JavaScript Macro) with the basic pageview request.

I have named my tracker so that I can access it and this code runs without any error in console, however when used with GTM, it's returning an error.

ga.getByName('trackerGTM').get('clientId'))

produces an error:

Uncaught ReferenceError: ga is not defined

Any tips?

解决方案

I assume you're firing the pageview {{url}} matches RegEx .*, correct? Could be that Universal hasn't loaded yet. Have you tried {{event}} equals gtm.dom? I haven't tested this, but it's a thought.

EDIT:

This looks like a bug. I was able to run:

function(){
  var client = ga.getAll()[0].get('clientId');
  return client;

}

And have it spit out the client ID with no problem.

这篇关于通过Google跟踪代码管理器访问Google Analytics设置的客户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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