通过python跟踪Google Analytics [英] Tracking to Google Analytics from python

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

问题描述

我试图从python后台跟踪GA事件进行电子商务分析。它在官方文档中的写法文档,这是发送一个请求,没有任何显示,我仍然有零访客在仪表板,但谷歌回复200和GIF。



在这个例子中,我发送了一个pageview,这在后台显然没有任何意义,但是对于调试来说这很简单。



这是我的代码:

 进口请求

有效载荷= {
'v':1,
'tid ':'UA-XXXXXX-Y',
'cid':555,
't':'pageview',
'dp':'/ home',
}
打印'发送到GA ...'
r = requests.post(http://www.google-analytics.com/collect,data =有效内容)
if r.ok :
print'ok'
else:
print':('

我已经禁用了所有过滤器在GA。

解决方案

似乎它是过滤器无论如何,神秘开始正常工作: b

I'm trying to track GA events from python backend for ecommerce analysis. The way it's written in the official documentation, that is sending a post request, nothing shows up, I still have zero visitors in the dashboard, but google replies with 200 and a GIF.

In this example I'm sending a pageview, which obviously makes no sense doing from the backend, but it's simple enough for debugging.

This is my code:

import requests

payload = {
    'v': 1,
    'tid': 'UA-XXXXXX-Y',
    'cid': 555,
    't': 'pageview',
    'dp': '/home',
}
print 'sending to GA...'
r = requests.post("http://www.google-analytics.com/collect", data=payload)
if r.ok:
    print 'ok'
else:
    print ':('

I have disabled all filters in GA.

解决方案

It seems that it was filters anyway, mysteriously started working properly :(

这篇关于通过python跟踪Google Analytics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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