开发者

Google Analytics from PHP CLI

开发者 https://www.devze.com 2023-03-08 12:42 出处:网络
Has anyone ever done Google Analytics tracking from a PHP command line program? I have a PHP command line program that is run th开发者_StackOverflow社区rough cron. It will grab data every 5 minutes a

Has anyone ever done Google Analytics tracking from a PHP command line program?

I have a PHP command line program that is run th开发者_StackOverflow社区rough cron. It will grab data every 5 minutes and I need to track that.

Looked at the GA library but it looks like either it's using JavaScript or it needs an <img> tag.

Please enlight.

Thank you,

Tee


http://code.google.com/p/serversidegoogleanalytics/

Never used it myself but looks like exactly what you're looking for.

Edit: Just pondering your question again and realised you were asking specifically for PHP CLI as a command line program. Just wanted to make sure you're aware that you can just use it to call a file and that'll be the only command line part. The rest of the program can be full OOP code (As my suggestion is structured) which includes files and extends classes.

So using CLI as Command line isn't really limiting as your tone suggests.


If you need to track that, just write a log file ..

file_put_contents('/tmp/myscript.log', "running cron\n", FILE_APPEND);

Google Analytics is used to track visits of a website and not cronjob activities. :s

0

精彩评论

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