1 open source' I community experience distilled. Piwik Web Analytics Essentials. Stephan A. Miller

Full text

(1)

Piwik

Web

Analytics

Essentials

A

complete guide

to

tracking

visitors

on

your

websites,

e-commerce

shopping

carts,

and apps

using

Piwik

Web

Analytics

Stephan

A. Miller

[

PUBLISHING BIRMINGHAM-MUMBAI

1

open

source'

(2)

Table of Contents

Preface 1

Chapter

1: Installation and

Setup

7

Meeting

system

requirements

8

Downloading

Piwik 9

Downloading

Piwik with SSH 10

Uploading

to a web

hosting

account 11

Uploading

using cPanel orother file managers 11

Uploading

using FTP 14

Creating

a database foryourinstallation 16

Creating a userand databasefor Piwik in cPanel 16

Creating

a userand databasefor Piwikwith

phpMyAdmin

18

Creating

a userand database for Piwik with SSH 20

Usingthe Piwikinstallation wizard 21

Securing

Piwik 27

Backing

up Piwik 29

Updating

Piwik 30

Using

Piwik for

high

traffic websites 34

Dedicatedserver 34

Adding

RAM 34

PHP caching 34

Nginx

or

lighttpd

35

Cron your

archiving

35

Disabling

real-time reports 35

Deleting

old logs 36

Load balancers and

multiple

servers 36

Limiting

tracked URLs 36

(3)

TableofContents

Chapter

2:

Using

Piwik's Interface and

Reports

39

Navigating

the Piwik interface 40

Using Piwik's Menus 41

TheSignIn menu 41

Thetop bar 42

The mainmenu 42

Customizing

the dashboard 44

Changingthe dashboard layout 44

Setting adaterange 46

Adding

widgets

to the dashboard 47

Moving

and

removing widgets

48

Finding

the right report widgetfor the

job

49

Visitors 49 Actions 50 Referrers 51 SEO 52 Visitor

settings

52 Goals 53 Visits

Summary

53 Live! 54

Reading

a Piwik report 55

Customizing

graphmetrics 56

Managing

e-mail reports 58

Summary

62

Chapter

3:

Tracking

Visitors with Piwik 63

Using

the Piwik

JavaScript tracking

code 63

Functioning

of defaultJavaScript 66

Triggering

page views

manually

68

Customizing

page names 70

Customizing

tracking

URLs 71

Configuring

Piwik's

tracking

cookies 72

Setting

up download and outlink

tracking

76

Disabling

link tracking 76

Triggering link

tracking

77

Downloading

file extensions 78

The download/outlink pause timer 79

Using

other PiwikJavaScriptAPI methods 79

setRequestMethod(method)

79

discardHashTag(bool)

80

(4)

setDoNotTrack(bool)

80

killFrame()

81

redirectFile(url)

81

setHeartBeatTimer(minumuin\/isitLength,heartBeatDelay)

81

getVisitorld()

82

getVisitorlnfo()

82

Using

multiple

trackers 82

Using

asynchronous tracking

83

Summary

86

Chapter

4:

Setting Up

and

Tracking

Goals 87

Defining goals 88

Desired actions 89

Conversions and conversion rate 90

Setting

up goals in Piwik 91

Setting

up revenue

tracking

94

Triggering

conversions

manually

97

Viewing

Goals overviewreports 105

Using goal

detail reports 110

Analysing

reports 111

Summary

112

Chapter

5:

Tracking Marketing Campaigns

113

Tracking

campaigns

using

URL parameters 114

Tracking

paid searches 119

Using Google

ValueTrack 120

Using

Microsoft Ad Center

dynamic

text 122

Using

Yahoo! Search

Marketing's

URL

tagging

123

Creating

campaign URLs the easy way 124

Tracking

socialmedia

campaigns

126

Campaign tagging

and

tracking

tips 127

Attributing

visits tothe correct

campaign

128

Customizing campaign

parameters 129

Viewing campaign

reports 130

Summary

132

Chapter

6:

Tracking

Events 133

Tracking

events withPiwik 134

Tracking

social engagement 138

Tracking

content

sharing

139

Tracking blog

comments 143

(5)

TableofContents

Tracking

Flashevents 148

Tracking

events with

ActionScript

2 149

Tracking events withActionScript3 149

Tracking page load time 150

Reading

customvariable reports 152

Otheruses for customvariables 154

Summary

154

Chapter

7: E-commerce Tracking 155

Enablinge-commerce

tracking

for yourwebsite 156

Tracking

orders and

products purchased

159

Tracking shopping

carts and items in them 162

Tracking

productand category page views 164

Adding

Piwik e-commerce

tracking

to ZenCart 165

Creating

functions in PHP to mirror Piwik'sfunctions 166

MixingPHP andJavaScript 172

Reading

and

using

Piwik's e-commercereports 174

Anoteabout SSL 183

Summary

184

Chapter

8: PiwikWebsite and User Administration 185

Changing

yourSuper User

settings

186

Creating

users in Piwik 188

Managing

website access 190

Who is a

Super

User? 191

Whatare admin permissions? 192

Whatare viewpermissions? 192

Managing websites 192

Adding

awebsite 192

Editing

or

deleting

a website 194

Editing

the global website

settings

195

Tracking

multiple domains orsubdomains with onewebsite account 196

Setting upan intranetasa website in Piwik 197

TurningPiwik into a white label analytics solution 198

Allowing

user

sign

up with the PiwikSignup

plugin

202

Installing

a Piwik plugin 203

How the user

Signup plugin

works 205

Summary

207

Chapter

9: Advanced

Tracking

and Development 209

Tracking visitors with image tracking 210

Simple image

tracking 211

(6)

Advanced

image tracking

214 Adding page titles to eBayauctiontracking 215

Trackingagoalwithan image 217

Tracking

visitors with thePHP tracking API 219

Generating

the

image

tracker 221

Making

an HTTPrequestto thetracker 225

Tracking

visitors with other

programming

languages 226

Java 226

Python

227

Silverlight 227

Flash 227

Using

Piwik'strackingAPI

directly

227

Debugging

your

tracking

code 230

Piwik

plugins

233

How Piwikworks 233

The

anatomy

ofa

plugin

234

Writing

a

simple

Piwik plugin 235

Summary

238

Chapter

10: Piwik Integration 239

CMS plugins 239

Piwik Mobile 243

Embedding

Piwikwidgets 246

Give your anonymous user

rights

246

Choosing

yourwidget 247

TheDashboardwidget 248

The All Websiteswidget 249

Choose yourownwidget 250

Accessing Piwik's data 252

How to call the analyticsAPI 252

Callingthe analyticsAPI using REST 253

CallingtheanalyticsAPI locally 256

Including graphs 260

Using

the Live!API 262

Segmentation

264

Creating

a change

log

for your website with analytics feedback 266

Summary

273

Appendix

A:

Tracking

API Reference 275

The Piwik

tracking

API 275

Variables 275

Methods 275

Constructor construct 275

(7)

TableofContents disableCookieSupport 276 doTrackAction 276 doTrackEcommerceCartUpdate 277 doTrackEcommerceOrder 277 doTrackGoal 278 doTrackPageView 278 enableBulkTracking 278 doBulkTrack 278 getAttributionlnfo 278 getBaseUrl 278 getCustomVariable 279 getRequestTimeout 279 getTimestamp 279 getUrlTrackAction 279 getUrlTrackGoal 279 getUrlTrackPageView 280 getVisitorld 280 setAttributionlnfo 280 setBrowserHasCookies 280 setBrowserLanguage 280 setCustomVariable 281 setDebugStringAppend 281 setEcommerceView 281 setForceVisitDateTime 282 setlp 282 setLocalTime 282 setPlugins 282 setRequestTimeout 283 setResolution 283 setTokenAuth 283 setUrl 283 setUrlReferrer 283 setUserAgent 284 setVisitorld 284

Appendix

B:

Analytics

API Reference 285

The Piwik analytics API 285

Module API 285 ModuleActions 286 Module CustomVariables 286 Module

ExampleAPI

286 Module Goals 286 Module

ImageGraph

287 Module

LanguagesManager

287 Module Live! 287 Module MultiSites 288 ModulePDFReports 288 Module Provider 288

(8)

Module Referers 288 Module SEO 288 Module

SitesManager

289 Module UserCountry 289 Module UserSettings 289 Module

UsersManager

289 Module

VisitFrequency

289 Module VisitTime 290 ModuleVisitorlnterest 290 ModuleVisitsSummary 290 Index 291

Figure

Updating...

References

Updating...

Related subjects :