Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Get data from Google Analytics on legacy sites

Nearly all greenfield projects at Spatie are built with Laravel. A few months ago I made laravel-analytics, a package to fetch data from Google Analytics.

Spatie exists for more than ten years so there are quite a few legacy projects as well. In those projects there is also a need to display some analytics data in the admin-section.  Recently Google retired some of their older API’s. Unfortunately our old solution to fetch GA data stopped working.

To resolve this problem my colleague Sebastian created a framework agnostic version of laravel-analytics that works with PHP 5.3. If you also have a legacy project that needs some data from Analytics, you can install the package via composer.

Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band.