Book Image

Piwik Web Analytics Essentials

By : Stephan A. Miller
Book Image

Piwik Web Analytics Essentials

By: Stephan A. Miller

Overview of this book

<p>Without web analytics, you are blind on the internet. In order to improve conversions and revenue on your web- site, you need to know what is going on. Piwik gives you this data and unlike Google Analytics, gives you total control over its usage. Unlike Google analytics where the data can be read by Google, Piwik maintains complete confidentiality of your website data. By harnessing the power of your tracked data, you can raise the conversion rates on your website to new heights.<br /><br />"Piwik Web Analytics Essentials" will show you how to install Piwik Open Source Analytics and have you tracking your website’s visitors within an hour after you pick up the book! After that, you will learn how to track custom events and programmatically trigger tracking events. The book continues with ecommerce tracking and advanced Piwik API usage.<br /><br />This book will take you from installing Piwik on your web server to writing custom tracking code for your apps.<br /><br />You will learn goal and event tracking techniques and how to add them to your standard tracking to fine tune your analytics results. Nothing is untrackable using Piwik: ecommerce shopping carts, web apps, phone apps, and more can make use of Piwik tracking capabilities.<br /><br />"Piwik Web Analytics Essentials" will walk you through every step with detailed screenshots and plenty of example code.</p>
Table of Contents (18 chapters)
Piwik Web Analytics Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

The Piwik analytics API


The Piwik analytics API allows you to access all the data remotely that is available in Piwik's interface. With it you can embed Piwik's data in another application using any programming language, or you can manipulate the data for reports and graphs not available in Piwik itself. Complete documentation of the Piwik analytics API is available at http://piwik.org/docs/analytics-api/reference/ or at the API link in any live Piwik installation.

Module API

This API provides metadata on all the other API methods. In other words, calling a function in the Module API will tell you what methods are available for you to use and will give you human-readable information on these methods. The following are some examples of its methods:

  • A list of all API methods using getReportMetadata

  • A list of metrics that each one of the previous methods will return along with their readable name, when you use getDefaultMetrics and getDefaultProcessedMetrics

  • A list of all the segments that you can use with functions that support segments using getSegmentsMetadata

You can read more about the methods available in the Metadata API at http://piwik.org/docs/analytics-api/metadata/.

Module Actions

The Actions API will give you information on all of your visitors' actions such as page titles, clicks on external links, and file downloads.

The getPageTitles method will return all of your page titles and the standard metrics available to that method.

You can also request the data for a single page title by using getPageTitle, by setting the pageName parameter to the page title you choose.

Some more of the methods available are getPageUrl, which will give you metrics for a specific page URL, getOutlink, which will give you outlink data, and getDownload, which will give you the downloaded files' data.

Note

The pageName , pageUrl , outlinkUrl , and downloadUrl parameters must be URL encoded before you call the API.

You can find out more about all of the functions available in the Actions API by visiting http://piwik.org/docs/analytics-api/reference/#Actions.

Module CustomVariables

The CustomVariables API lets you access reports for your CustomVariables names and values. It has only two functions shown as follows:

CustomVariables.getCustomVariables (idSite, period, date, segment = '', expanded = '').
CustomVariables.getCustomVariablesValuesFromNameId (idSite, period, date, idSubtable, segment = '').

Module ExampleAPI

The ExampleAPI is useful to developers building a custom Piwik plugin. It is essentially a toy API created to help you learn. You can read more about it at http://piwik.org/docs/analytics-api/reference/#ExampleAPI.

Module Goals

The Goals API gives you control over your goals. You can use updateGoal to change a goal's details, deleteGoal to remove a goal, and addGoal to create a new goal. And if you want to list the goals for one or more websites, you can use the getGoals method.

Another feature is that this API provides access to your e-commerce tracking data. You can retrieve a list of products purchased on your site by using getItemsSku, getItemsName, or getItemsCategory. These methods will return a list of products that have been purchased on your site along with supporting metrics.

You can explore more of the Goals API by visiting http://piwik.org/docs/analytics-api/reference/#Goals.

Module ImageGraph

The ImageGraph API will return PNG graphs for any Piwik report that supports them. In your request, you can specify these graph types as line plot, vertical bar chart, or 2D/3D pie chart. You can also specify the width, height, font size, and even the colors of the graph being returned.

You can read more about the ImageGraph API at http://piwik.org/docs/analytics-api/reference/#ImageGraph.

Module LanguagesManager

The LanguagesManager API lets you translate the data you receive from Piwik into any one of the 40+ languages that Piwik supports.

For more information on the LanguagesManager API, please visit http://piwik.org/docs/analytics-api/reference/#LanguagesManager.

Module Live!

The Live! API will give you real-time information about your visitors. You can also use segmentation with this API to drill down your data to very specific subsets. The getLastVisitsDetails method will give you a massive amount of detail on each of your visitors. By adding the parameter &segment=, you can use segmentation to filter the visits that have been returned by any valid criteria.

The getCounters method will return a simple count of visits, actions, or converted visits for your chosen time period.

Here are the two methods available in the Live! API.

Live.getCounters (idSite, lastMinutes, segment = '')
Live.getLastVisitsDetails (idSite, period, date, segment = '', filter_limit = '', maxIdVisit = '', minTimestamp = ''). 

Module MultiSites

The MultiSites API will return the key metrics from all the websites you are tracking in Piwik. It only has one method, listed as follows

MultiSites.getAll (period, date, segment = '') 

Module PDFReports

The PDFReports API gives you remote control over Piwik reports. With it, you can generate, download, email, or schedule reports.

To learn more about the PDFReports API, please see http://piwik.org/docs/analytics-api/reference/#PDFReports and http://piwik.org/docs/email-reports/.

Module Provider

The Provider API lets you access reports for your visitors' Internet providers such as Comcast, Road Runner, and Cox. It has only one method:

Provider.getProvider (idSite, period, date, segment = '')

Module Referers

The Referers API will give you data on the referrers that visitors used to find your website. It will return data on websites, search engines, keywords, and campaigns.

An example widget that uses the referrer API is available at http://tinyurl.com/9b8z8hz.

You can read more about the Referers API at http://piwik.org/docs/analytics-api/reference/#Referers.

Module SEO

The SEO API returns a list of SEO data on your URL. It will give you Google PageRank, Yahoo! backlinks, Yahoo! indexed pages, Alexa Rank, and domain name age. Here is its one method:

  • SEO.getRank (url)

Module SitesManager

The SitesManager API lets you control your websites in Piwik remotely. You can create, update, and delete the websites that your Piwik installation tracks as well as retrieve data on the configuration of those sites.

You can read more about all the methods available in the SitesManager API at http://piwik.org/docs/analytics-api/reference/#SitesManager.

Module UserCountry

The UserCountry API will return reports about your visitors' countries and continents.

You can read more about this API at http://piwik.org/docs/analytics-api/reference/#UserCountry.

Module UserSettings

The UserSettings API will return reports about your visitors' browsing environment including the browser they use, their operating system, plugins they have installed in their browser, their screen resolution and their screen type.

You can learn more about all the methods available in this API at http://piwik.org/docs/analytics-api/reference/#UserSettings.

Module UsersManager

The UsersManager API allows you to control Piwik users remotely. You can add, delete, update or get information about the users that have access to your Piwik installation.

To find out more about these methods and others available in the UsersManager API please visit http://piwik.org/docs/analytics-api/reference/#UsersManager.

Module VisitFrequency

The VisitFrequency API lets you access a list of metrics related toreturning visitors. It has one method:

VisitFrequency.get (idSite, period, date, segment = '', columns = '')

Module VisitTime

The VisitTime API lets you access reports by hour (server time), and by hour (local time) of your visitors. It has only these two methods:

  • VisitTime.getVisitInformationPerLocalTime (idSite, period, date, segment = '')

  • VisitTime.getVisitInformationPerServerTime (idSite, period, date, segment = '', hideFutureHoursWhenToday = '')

Module VisitorInterest

The VisitorInterest API gives you visitor engagement reports.

You can find out more about this API at http://piwik.org/docs/analytics-api/reference/#VisitorInterest.

Module VisitsSummary

The VisitsSummary API lets you access the core web analytics metrics.

To read about all the methods you can use with this API, please see http://piwik.org/docs/analytics-api/reference/#VisitsSummary.