如何从 Python 触发 Google Analytics 事件? [英] How to trigger Google Analytics events from Python?

查看:33
本文介绍了如何从 Python 触发 Google Analytics 事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个具有 REST API 的网站,我想使用 Google Analytics 事件跟踪 API 使用情况.是否有一种直接的方法可以从 Python 触发 GA 事件,而无需加载整个 webbrowser 组件只是为了发送 javascript 请求?

I'm developing a site that has a REST API and I'd like to track the API usage using Google Analytics events. Is there a straightforward way to trigger GA events from Python that doesn't involve loading up an entire webbrowser component just to send a javascript request?

推荐答案

这里有一个用 Python 实现的 Google-Analytics for Mobile 的开源实现:http://github.com/b1tr0t/Google-Analytics-for-Mobile--python-

There is an open source implementation of Google-Analytics for Mobile in python available here: http://github.com/b1tr0t/Google-Analytics-for-Mobile--python-

您可能可以将其集成到通过导入您自己的设置'track_page_view' 并提供它使用适当的 WSGI 请求环境.

You can probably integrate this into your own setup by importing 'track_page_view' and providing it with the appropriate WSGI request environment.

这篇关于如何从 Python 触发 Google Analytics 事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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