Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
How to Create A Most Popular List with Laravel and Google Analytics
Sep 02, 2016 @ 14:40:16

On the Laravel News site there's a new post showing you how to make use of the Google Analytics API in your Laravel application to find trending content in your site (most accessed pages).

Here on Laravel News, I wanted to generate a list of the most popular posts for the past seven days and display the results from most popular to least popular. To solve this problem I thought of two solutions. The first is to build my own tracking system so I could keep a count and then use it for ordering. However, that could generate a huge amount of data and it seemed like a solution that an analytics tracking service could handle.

As I was fumbling through the Google Analytics API I found a Laravel Analytics package by Spatie.be that allows you to easily retrieve data from your Google Analytics account and it seemed like the best way to solve this problem. Let’s look at how I used it to generate a list of popular posts here on Laravel News.

They then walk you through the installation (via Composer) and configuration of the library. This includes linking to more information about setting up the credentials for the connection. They then show how to use it to fetch the most popular pages and what the response looks like as a collection. Finally they show you how to create a wrapper class you can easily reuse anywhere in your application to fetch and display this "trending" information". The post ends showing you how to create a "View Composer" that only fires when the view is being rendered, not on every request.

tagged: laravel googleanalytics trending popular page results tutorial package

Link: https://laravel-news.com/2016/09/most-popular-list-laravel-google-analytics/

MaltBlue.com:
Use Zend Framework Modules and Save Development Time
Dec 23, 2013 @ 18:09:26

On his MaltBlue blog Matthew Setter has a new post looking at using Zend Framework modules to save time and make for more reusable, flexible code.

One of the standout concepts in Zend Framework 2 is that it's based on modules. Just about everything is one, and by designing it that way, it's overcome one of the key failings of Zend Framework 1. In version 1, if you're familiar with it, to reuse code across multiple projects wasn't easy - it wasn't easy at all. There was the inevitable problem of running into code duplication and too high a level of coupling. In version 2 - that's history!

In a previous article he looked at how these modules work, but in this latest one he digs in and gets into an actual example you can poke around in. He shows you how to install his sample Google Analytics module and get it set up in your ZF-based project. It drops in the Google Analytics Javascript tracking code at the bottom of the site, using the ID you provided during configuration.

tagged: zendframework2 modules googleanalytics

Link: http://www.maltblue.com/tutorial/intermediate/use-zend-framework-modules-save-development-time

Kevin Schroeder's Blog:
Added (PHP 5.3) job queuing to my WordPress instance
Mar 21, 2011 @ 15:09:05

Kevin Schroeder has a quick post to his blog talking about the integration of job queuing he's done with his WordPress blog to build a list of popular posts for his sidebar.

One of the things I liked on my old blog was the ability to have a Popular Posts section that was based off of Google Analytics. [...] So I had missed that, but it was not overly important so I left it. But yesterday was a day where I needed something that was both engaging and brainless to do. So I decided to implement my Job Queue API code for WordPress so that I could write a WordPress widget that would put the popular posts in the sidebar.

He's created a plugin to handle most of the heavy lifting for you.

tagged: job queue wordpress popularpost googleanalytics plugin

Link:

PHPBuilder.com:
Create Custom Google Analytics Interfaces Using PHP
Mar 19, 2010 @ 14:13:49

On PHPBuilder.com today there's a new tutorial from Jason Gilmore showing how you can interface your application with the Google Analytics service through its HTTP API. Jason shows ho to use the Google Analytics API PHP Interface tool to take most of the hard work out of it.

Google Analytics (GA) is the de facto solution for analyzing web site traffic and trends. [...] If you're not regularly relying upon Google Analytics or a similarly capable analytical service, then you're left at a major competitive disadvantage in terms of your ability to effectively understand the interests, demographics, and technical requirements of your audience.

Using the Google Analytics site is a pleasant experience, but having to log in just to check your numbers each day can get tiresome quickly. Jason introduces a way, using the GAPI class to pull things like traffic statistics and account information. More examples of how it can be used are shown on the GAPI website.

tagged: googleanalytics interface http tutorial gapi

Link:


Trending Topics: