如何以编程方式获取Google Analytics中当前访问的广告系列/来源/媒介

时间:2022-02-21 14:31:27

I'd like to know how active are the users depending on the source/medium/campaign of the traffic they came from before sign up. I'm hitting wall when trying to get campaign/source/medium for the current visit from Google Analytics tracker in JS.

我想知道用户的活跃程度取决于他们在注册之前来自的流量来源/媒介/广告系列。当我试图通过JS中的Google Analytics跟踪器获取当前访问的广告系列/来源/媒介时,我正在打击墙。

I found this tracker.get() method: https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference#get but they don't specify what are the possible values for 'fieldName'. I inspected the tracker object in Firebug and found out the screen attached screen grab:

我找到了这个tracker.get()方法:https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference#get但他们没有指定'fieldName'的可能值。我在Firebug中检查了跟踪器对象,发现屏幕附带的屏幕抓取:

如何以编程方式获取Google Analytics中当前访问的广告系列/来源/媒介

Are these the only fields that I can query? Is reading any of the campaign fields possible? I understand that GA intends to be anonymous, but I figured this information is not really a secret...

这些是我可以查询的唯一字段吗?是否可以阅读任何广告系列字段?我知道GA打算匿名,但我认为这些信息并不是真正的秘密......

If I can't retrieve this information from GA tracker, how would you approach this question? Should I set my own cookie whenever there's a visit with utm_ parameters and then read it if the visitor chooses to sign up?

如果我无法从GA跟踪器中检索此信息,您将如何处理此问题?我是否应该在访问utm_参数时设置自己的cookie,然后在访问者选择注册时阅读它?

I'm aware of this response: How do I extract Google Analytics campaign data from their cookie with Javascript? but a comment says parsing a cookie won't work for AdWords traffic..

我知道这个回复:如何使用Javascript从Cookie中提取Google Analytics广告系列数据?但评论说解析cookie不适用于AdWords流量..

1 个解决方案

#1


0  

I had to do something similar for a project. You need to think outside of the box to get this working. This will only work for cases where you put the campagn information in the url, for tagged url's.

我不得不为一个项目做类似的事情。你需要在框外思考才能实现这一目标。这仅适用于将campagn信息放在url中的情况,用于标记的url。

1) On every page add server side code(php, asp .net) to parse the querystring and save the campagn/source/medium from the url in a session(or cookie)

1)在每个页面上添加服务器端代码(php,asp .net)来解析查询字符串并在会话(或cookie)中保存来自url的campagn / source / medium

2) Retrieve this information where you need it and process it.

2)在您需要的地方检索此信息并进行处理。

#1


0  

I had to do something similar for a project. You need to think outside of the box to get this working. This will only work for cases where you put the campagn information in the url, for tagged url's.

我不得不为一个项目做类似的事情。你需要在框外思考才能实现这一目标。这仅适用于将campagn信息放在url中的情况,用于标记的url。

1) On every page add server side code(php, asp .net) to parse the querystring and save the campagn/source/medium from the url in a session(or cookie)

1)在每个页面上添加服务器端代码(php,asp .net)来解析查询字符串并在会话(或cookie)中保存来自url的campagn / source / medium

2) Retrieve this information where you need it and process it.

2)在您需要的地方检索此信息并进行处理。