https://github.com/basvdijk/server-side-google-analytics-proxy
Server side Google Analytics proxy written in PHP
https://github.com/basvdijk/server-side-google-analytics-proxy
google-analytics-api
Last synced: 7 months ago
JSON representation
Server side Google Analytics proxy written in PHP
- Host: GitHub
- URL: https://github.com/basvdijk/server-side-google-analytics-proxy
- Owner: basvdijk
- Created: 2019-06-16T11:06:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-16T11:19:55.000Z (over 6 years ago)
- Last Synced: 2025-01-29T04:25:08.784Z (12 months ago)
- Topics: google-analytics-api
- Language: PHP
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Server side Google Analytics proxy
## Introduction
This code creates a service side proxy to Google Analytics using the [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide).
_Warning: This code is far from feature complete and is more a MVP to log `page view` and `events`_
## Installation
In the `src` folder, copy `config.example.php` to `config.php` and set the values in `config.php`.
For more security replace `e0b3d458-b76e-40f5-b186-86ca96a4a578` in all files with your own GUID or unique string.
## Running
Install the files on your server, for debugging you can run `php -S localhost:8000` in the `src` folder to run it locally.
## Postman
[Postman](https://www.getpostman.com/) is a tool to make server calls. Inside the Postman folder, you'll find Postman script to test the API.
## API
### Pageview
#### Url
http://localhost:8000?type=page_view&title=Test%20article%201&path=articles/test-article-1
#### Parameters
```
type Analytics call type
title Title of the page
path URI of the page without slash at beginning
```
### Event
#### Url
http://localhost:8000?type=event&category=shopping&action=purchase&label=amount&value=123.45
#### Parameters
```
type Analytics call type
category Event category
action Event action
label Event label
value Event value
```