当前位置: 首页 >> 榆树网-网络 >> 文章正文

Data Export API – Protocol

摘自:http://code.google.com/intl/zh-CN/apis/analytics/docs/gdata/1.0/gdataProtocol.html

Example Account Feed Request

USER_EMAIL="" #Insert your Google Account email here USER_PASS="" #Insert your password here googleAuth="$(curl https://www.google.com/accounts/ClientLogin -s \ -d Email=$USER_EMAIL \ -d Passwd=$USER_PASS \ -d accountType=GOOGLE \ -d source=curl-accountFeed-v1 \ -d service=analytics \ | awk /Auth=.*/)" feedUri="https://www.google.com/analytics/feeds/accounts/default\ ?prettyprint=true" curl $feedUri -s --header "Authorization: GoogleLogin $googleAuth"

Retrieving Report Data

USER_EMAIL="" #Insert your Google Account email address here
USER_PASS="" #Insert your password here
PROFILE_ID="" #Insert your profile ID here

googleAuth="$(curl https://www.google.com/accounts/ClientLogin -s \
  -d Email=$USER_EMAIL \
  -d Passwd=$USER_PASS \
  -d accountType=GOOGLE \
  -d source=curl-accountFeed-v1 \
  -d service=analytics \
  | awk /Auth=.*/)"

feedUri="https://www.google.com/analytics/feeds/data\
?start-date=2008-10-01\
&end-date=2008-10-31\
&dimensions=ga:source,ga:medium\
&metrics=ga:visits,ga:bounces\
&sort=-ga:visits\
&filters=ga:medium%3D%3Dreferral\
&max-results=5\
&ids=ga:$PROFILE_ID\
&prettyprint=true"

curl $feedUri -s --header "Authorization: GoogleLogin $googleAuth"

相关文章

发表评论