2013-08-20 59 views

回答

3

你只需要一個URL:

conn.request("POST", "/collect", "v=1&tid=UA-XXXXXX-Y&cid=666&t=event&ec=game&ea=start&ev=0") 

或者藉助詞典:

import httplib, urllib 

params = urllib.urlencode({ 
    'v': 1, 
    'tid': 'UA-XXXXXX-Y', 
    'cid': '666', 
    't': 'event', 
    'ec': 'game', 
    'ea': 'start', 
    'ev': 0 
}) 

connection = httplib.HTTPConnection('www.google-analytics.com') 
connection.request('POST', '/collect', params) 
+0

非常感謝您!有效! – m3nthal

+0

您可以使用fiddler http調試器來跟蹤這個工作示例併發布原始請求和響應嗎?我想解決我的問題http://stackoverflow.com/questions/19451738/universal-analytics-measurement-protocol-respond-200-ok-but-no-events-appers – qub1n

相關問題