Google Analytics API PHP Class – Get most popular pages
The following shows example usage to get the most popular pages from Google Analytics using my PHP class for the GA API.
PHP is a powerful open source server-sided scripting language that can be used on a wide variety of operating systems and webservers, including Apache on UNIX and IIS on Windows.
PHP contains numerous extensions which enable you to dynamically create images and flash files, parse xml, connect to remote servers using pop, imap, ftp, http and raw sockets, natively access many database servers including PostgreSql, MySQL and Microsoft SQL Server, compress and decompress files, lookup domain names and and much more.
PHP has an excellent manual and online documentation which covers every function for every extension available.
The following shows example usage to get the most popular pages from Google Analytics using my PHP class for the GA API.
PHP’s get_included_files() function returns an array containing a list of included files by your script, including the script itself. This post looks at the filenames returned in the array and corrects a couple of errors in the PHP documentation.
This is a summary post with links through to all the posts on my blog where I’ve looked at various functions using PHP’s IMAP functions to download mail and extract attachments etc.
The Google Analytics API allows filtering to be done on the result data before it is fetched so you could, for example, only get data for visitors from the United States. This post shows how to format the filters field in PHP and also how to use my Google Analytics API PHP Class with filters.
I’ve previously looked at how to set PHP configuration options in an Apache .htaccess file which allows you to change PHP_INI_PERDIR or PHP_INI_ALL settings but notPHP_INI_SYSTEM. All three of these settings types can be modified in an Apache virtualhost’s settings.
I have previously looked at rounding numbers with MySQL and Javascript and in this post look at rounding numbers with PHP using the round() ceil() floor() number_format() and s/printf() functions.