Edx platform 源码:关于event tracking

edx platform的源代码里面,有谁知道哪里用到tracker了嘛?因为XBlock可能是learning tool,后续要评价learning tool是否达到了预期的效果,因此tracking用户的点击行为尤为重要。目前,edx里面有基本的跟踪,比如下图,但是我源码不熟悉,没找到怎么调用tracker。



自问自答:感谢@种瓜 qq群里分享。


Get a quick feeling for how to emit events from three different parts of the code base: Python, JavaScript, and XBlocks.

Example 0: Find the tracking log file
On localhost devstack, the tracking log file is located in /edx/var/log/tracking/tracking.log .

If you’re working with a sandbox, first SSH in as described in the DevOps Sandboxes wiki page, and then find the tracking log file.

Tail this file from a command line to see events emitted ‘in real time’.

Example 1:**** (Server-side events) Emit an event in Python. This should set event_source: server .
from eventtracking import tracker

‘name’: ‘foo’,
‘address’: {
‘postal_code’: ‘90210’,
‘country’: ‘United States’
Examples in the code: https://github.com/edx/edx-platform/search?utf8=✓&q=tracker.emit
More information and testing approaches: http://edx.readthedocs.org/projects/edx-developer-guide/en/latest/analytics.html

Example 2: Emit an event in JavaScript. This should set event_source: browser.
Logger.log(“edx.video.awesome_mode_enabled”, {“button_pressed”: “the really big purple one”, “button_id”: 15, “…”})

Example 3:Emit events in XBlocks
self.runtime.publish(self, “company.xblock.content.viewed”, event_data)

其他相关信息,请查看open edx 关于 Event Design and Review Process的官方文档: 1.https://openedx.atlassian.net/wiki/display/AN/Event+Design+and+Review+Process

Powered by eduStack & ifLab