Skip to content

Commit

Permalink
Merge pull request #9 from escopecz/release/1.4.0
Browse files Browse the repository at this point in the history
Release 1.4.0
  • Loading branch information
cworreschk authored Jan 4, 2017
2 parents 91b577a + 964bd5f commit fac18c7
Show file tree
Hide file tree
Showing 11 changed files with 452 additions and 176 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# top-most EditorConfig file
root = true

# All files
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

# 4 space indentation for PHP
[*.php, *.inc]
indent_style = space
indent_size = 4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.idea
/.idea
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# v1.4.0
## 01/04/2017

1. [](#new)
* Preload the Google Analytics script asynchronously
* Choose the code position in the HTML document (head or body)
* Custom Cookie Configuration. Name, domain and expiration time are configurable.
* Force SSL - Send all data using SSL, even from insecure (HTTP) pages
1. [](#improved)
* Improve plugin configuration with tab views.
* Better use and configuration of the global object name. Please use `objectName` instead of `renameGa`.

# v1.3.0
## 12/21/2016

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Grav
Copyright (c) 2016 John Linhart ([email protected]), Christian Worreschk ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
93 changes: 70 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,90 @@
# Google Analytics Grav Plugin
# Grav Google Analytics Plugin

This is [Grav CMS](http://getgrav.org) plugin that helps you implement [Google Analytics](https://www.google.com/analytics) tracking code into your website. That way your GA tracking will be theme-independent.
The **Google Analytics** Plugin for [Grav CMS](http://github.com/getgrav/grav) allows you to integrate and configure [Google Analytics](https://www.google.com/analytics) without the need to touch any code within your Grav site.

# Installation
### Features
* Preload the Google Analytics script asynchronously
* IP Anonymization
* Choose the Google Analytics code position in the HTML document (head or body).
* Force SSL (HTTPS). Send all data using SSL, even from insecure (HTTP) pages.
* Renaming of the Global (ga) Object
* Debug Mode with Trace Debugging
* Custom Cookie Configuration. Name, domain and expiration time are configurable.
* Blocking IP Addresses
* Multi-Language Support for the [Grav Administration Panel](https://github.com/getgrav/grav-plugin-admin)

Installing the Google Analytics plugin can be done in one of two ways.
## Installation

## GPM Installation (Preferred)
Installing the Google Analytics plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.

The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's Terminal (also called the command line). From the root of your Grav install type:
### GPM Installation (Preferred)

The simplest way to install this plugin is via the [Grav Package Manager (GPM)](http://learn.getgrav.org/advanced/grav-gpm) through your system's terminal (also called the command line). From the root of your Grav install type:

bin/gpm install ganalytics

This will install the Google Analytics plugin into your `/user/plugins` directory within Grav. Its files can be found under `/your/site/grav/user/plugins/ganalytics`.

## Manual Installation
### Manual Installation

To install this plugin, just [download](https://github.com/escopecz/grav-ganalytics/archive/master.zip) the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `ganalytics`.
To install this plugin, just download the zip version of this repository and unzip it under `/your/site/grav/user/plugins`. Then, rename the folder to `ganalytics`. You can find these files on [GitHub](https://github.com/escopecz/grav-ganalytics) or via [GetGrav.org](http://getgrav.org/downloads/plugins).

You should now have all the plugin files under

/your/site/grav/user/plugins/ganalytics

> NOTE: This plugin is a modular component for Grav which requires [Grav](http://github.com/getgrav/grav) to operate.
# Config Defaults
## Configuration

```
enabled: true # Global enable/disable the entire plugin
trackingId: '' # GA Tracking ID `REQUIRED`
renameGa: '' # Other name for the global (ga) variable
anonymizeIp: false # Enable/Disable IP Anonymization
blockedIps: # Array of blocked IPs
debugStatus: false # Enable/disable Debugging
debugTrace: false # Enable/Disable Trace Debugging
```
Before configuring this plugin, you should copy the `user/plugins/ganalytics/ganalytics.yaml` to `user/config/plugins/ganalytics.yaml` and only edit that copy.

Here is the default configuration and an explanation of available options:

If you need to change any value, then the best process is to copy the [ganalytics.yaml](ganalytics.yaml) file into your `users/config/plugins/` folder (create it if it doesn't exist), and then modify there. This will override the default settings.
```yaml
enabled: true
trackingId: ""

# Usage
position: "head"
objectName: "ga"
forceSsl: false
async: false
anonymizeIp: false
blockedIps: []

cookieConfig: false
cookieName: "_ga"
cookieDomain: ""
cookieExpires: 63072000

debugStatus: false
debugTrace: false
```
1. In your Google Analytics account, open the analytics of the Grav website (or create new if doesn't exist yet).
2. Go to *Admin* / *Tracking Info* / *Tracking Code*
3. Copy the *Tracking ID* and insert it to the configuration of this plugin.
* `enabled` Toggles if the Google Analytics plugin is turned on or off.
* `trackingId` The Google Analytics Tracking ID. This value is **required**.

* `position` Code Position in the HTML document (`head` or `body`). Default is `head`.
* `async` Toggles if the Google Analytics script is preloaded asynchronously.
* `forceSsl` Toggles if Google Analytics should send all data using HTTPS.
* `objectName` The name for the global (ga) object. Default is `ga`.
* `anonymizeIp` Toggles if Google Analytics will anonymize the IP address for all hits.
* `blockedIps` Here you can blacklist IP addresses. For those the Google Analytics script will not be embedded.

* `cookieConfig`: Toggles if the a custom cookie configuration should be used.
* `cookieName` The cookie name. Default ist `_ga`
* `cookieDomain` The cookie domain.
* `cookieExpires` The cookie expiration time in seconds. Google default is 2 years (`63072000` seconds)

* `debugStatus` Toggles if the debug version of Google Analytics is enabled or disabled.
* `debugTrace` Toggles if the debugger will output more verbose information to the console. `debugStatus` must be enabled.

## Usage

1. Sign in to your [Google Analytics account](https://www.google.com/analytics/web/#home).
2. Select the **Admin** tab.
3. Select an account from the dropdown in the _ACCOUNT_ column.
4. Select a property from the dropdown in the _PROPERTY_ column.
5. Under _PROPERTY_, click **Tracking Info > Tracking Code**.
6. Copy the **Tracking ID** (a string like _UA-000000-01_)
7. Add it to the configuration of this plugin.
Loading

0 comments on commit fac18c7

Please sign in to comment.