开发者

Read download count from google-analytics using Javascript

I am using the async version of the code in an onclick event for each download. I would like to read the count from Google-Analytics for a labeled event, to show next to the download开发者_开发知识库 button.

Is this possible in Javascript? I do not have the option to use php or perl.

Thanks, BoB


Even if possible you should not do it.

The google analytics data export API requires you to sign in using your google credentials to do API requests. Once you do it you have access to all your data on all your profiles.

So doing it means using client side code to log on the API using your credentials, and get only one metric, although all other are available.

The right way to do it is to use server side code to get that data and store it somewhere to be later queried by Javascript code.

Google Analytics data can be misleading and there's no reason you go though all this to get the download count. You're better just coding your own backend to count downloads.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜