Google analytics 实时测量网站访问量和页面浏览量的最佳方法是什么?
我目前使用Adobe Omniture SiteCatalyst、Google Analytics和New Relic。这三种服务都提供访问和页面浏览指标。据我所知,SiteCatalyst没有API,他们的数据往往落后数小时。Google Analytics和New Relic都提供实时API,但我发现不同供应商提供的指标差异很大 衡量实时访问(页面浏览量、唯一访客等)的最佳方法(API)是什么Google analytics 实时测量网站访问量和页面浏览量的最佳方法是什么?,google-analytics,newrelic,website-metrics,Google Analytics,Newrelic,Website Metrics,我目前使用Adobe Omniture SiteCatalyst、Google Analytics和New Relic。这三种服务都提供访问和页面浏览指标。据我所知,SiteCatalyst没有API,他们的数据往往落后数小时。Google Analytics和New Relic都提供实时API,但我发现不同供应商提供的指标差异很大 衡量实时访问(页面浏览量、唯一访客等)的最佳方法(API)是什么 最终,我打算使用这些数据向我的业务客户提供实时转换率。什么样的延迟是可以接受的?准确度和细节如何?
最终,我打算使用这些数据向我的业务客户提供实时转换率。什么样的延迟是可以接受的?准确度和细节如何?基于脚本的系统(如Google Analytics)需要启用Javascript,并提供大量关于访问者人口统计和技术信息的详细信息,但原始Web服务器日志文件可以提供关于每个请求的详细信息(这对于技术洞察力更好,因为您可以获得有关请求的图像、热链接、参考者和其他文件的详细信息)
就我个人而言,我只会使用Google Analytics,因为我熟悉它,也因为他们的CDN服务器意味着我的网站不会加载得很慢;但除此之外,我只会在我的原始Web服务器日志上运行典型的日志文件分析软件,但是根据您的软件,此文件分析可能需要时间来生成报告。Adobe SiteCatalyst does有一个您可以使用的实时api。它的功能类似于SiteCatalyst工作中的报告 以下是python请求示例:
import requests
import sha
import binascii
import time
your_report_suite="ReportSuiteId" #The name of the report suite
what_you_are_looking = "someValue" #value of a the prop that you want to find in the realtime stream
def getRealTimeUsers():
if mobile:
url = 'https://api.omniture.com/admin/1.3/rest/?method='
headers = {'X-WSSE': self.generateHeader()}
method = 'Report.GetRealTimeReport'
report_url = url + method
payload = {
"reportDescription": {
"reportSuiteID": your_report_suite,
"metrics": [
{
"id": "instances"
}
],
"elements": [
{
"id": "prop4",
"search": {
"type": "string",
"keywords": what_you_are_looking
}
}
]
}
}
response = requests.post(url=report_url, headers=headers, data=json.dumps(payload))
data = response.json().get('report').get('data')
def generateHeader():
# Generates the SC headers for the request
nonce = str(time.time())
base64nonce = binascii.b2a_base64(binascii.a2b_qp(nonce))
created_date = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.localtime())
sha_object = sha.new(nonce + created_date + self.sc_key)
password_64 = binascii.b2a_base64(sha_object.digest())
return 'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"' % (
self.sc_user, password_64.strip(), base64nonce.strip(), created_date)
注意:实时报告要求在您的报告套件中启用实时功能。此外,实时报告的维度有限。对于所需的特定请求,没有大量文档,但有以下几点:
另外,我强烈建议使用api explorer进行实验:我没有硬性要求,但我怀疑一小时是上限。我不知道这有多合理。