适用于低端移动设备的 Google Analytics 自定义变量(无 JavaScript)
我正在 Mxit 平台上工作想要创建并捕获一些自定义变量以存储在 Google Analytics 中。
使用 Mxit 门户,浏览器和浏览器之间不再是通常的通信。网络服务器。它是电话应用程序、mxit 服务器、Web 服务器。 Mxit 位于中间,这意味着我们无法直接捕获用户特定信息。
然而,Mxit 确实设置了带有附加用户信息的自定义标头,这些信息可以通过自定义变量捕获以用于分析。
我们无法使用 javascript,因此我安装了 Analytics for mobile php 脚本,该脚本创建数据并将其附加到 gif 图像。
我已经通过 javascript 在普通网站上设置了自定义变量,并使用 GA 调试复制了 utme 参数并将其添加到 GA for mobile php 代码中,以手动附加到 gif 查询字符串。
这是一个快速、过于简化的示例:
我想要设置的自定义值。
$id = $headers['mxitID'];
$country = $headers['country'];
$gender = $headers['gender'];
$age = $headers['age'];
在这里,我附加到 gif 查询字符串,
&utme=8(MxitID*Country*Gender*Age)9($id*$country*$gender*$age)11(1*1*1*1)
按照我的理解,8() 代表自定义变量名称,9() 代表自定义变量值,11() 代表范围。
现在已经2天了,Google Analytics中仍然没有自定义变量信息。
我正在检查访客 >自定义变量
任何帮助将不胜感激。
I'm working on the Mxit platform & would like to create and capture some custom variables to store in Google Analytics.
With Mxit portals, it's not the usual communication between browser & web server. It's phone app, mxit server, web server. Mxit sits in the middle, which means we can’t directly capture user specific info.
Mxit does however set custom headers with additional user info, which can be captured for Analytics via custom variables.
We can't make use of javascript, so I’ve installed the Analytics for mobile php script, which creates and appends data to the gif image.
I've set the custom variables on a normal website via javascript and using GA debug I copied the utme parameter and added it to the GA for mobile php code to append to manually append to the gif query string.
Here's a quick, over simplified example:
The custom values I'd like to set.
$id = $headers['mxitID'];
$country = $headers['country'];
$gender = $headers['gender'];
$age = $headers['age'];
and here I'm appending to the gif query string
&utme=8(MxitID*Country*Gender*Age)9($id*$country*$gender*$age)11(1*1*1*1)
The way I understand it, 8() represents the custom variable names, 9() represents the custom variable values and 11() represents the scope.
It's been 2 days now, and there is still no custom variable information in Google Analytics.
I'm checking Visitors > Custom Variables
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Google 针对这个问题有一个服务器端解决方案。您可以在此处找到代码:https://developers.google.com/analytics/ devguides/collection/other/mobileWebsites
这是该库的实现
然后在您看来您会这样做:
Google has a server-side solution just for this issue. You can find the code here: https://developers.google.com/analytics/devguides/collection/other/mobileWebsites
Here's an implementation of that library
And then in your view you do:
我为此编写了一些代码。
您可以根据需要修改它。 :{D
https://github.com/WillemLabu/ga-collection
I wrote some code for this.
You can modify it as you wish. :{D
https://github.com/WillemLabu/ga-collection