Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: peaksandpies/universal-analytics
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 28fc799120be98c18278226eb81238ba28b45c6b
Choose a base ref
...
head repository: peaksandpies/universal-analytics
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0846ead22359690362e7b6515067f83ec96e90d0
Choose a head ref
  • 11 commits
  • 4 files changed
  • 5 contributors

Commits on Jun 5, 2018

  1. Update README.md

    Added information on filtering out application tracking data from web data. Added NPM badge.
    XanderLuciano authored Jun 5, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    47a55a0 View commit details
  2. Typo Fix

    XanderLuciano authored Jun 5, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0e86f08 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    00c9317 View commit details
  4. Merge pull request #109 from XanderLuciano/history-update

    Updated repo history for version 0.4.17
    jtillmann authored Jun 5, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    63c5514 View commit details

Commits on Jun 18, 2018

  1. Merge pull request #108 from XanderLuciano/documentation-update

    Add instructions for filtering views
    jtillmann authored Jun 18, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e13640c View commit details

Commits on Sep 15, 2018

  1. Regenerate package-lock.json

    pioug committed Sep 15, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    pioug Gilles Piou
    Copy the full SHA
    1a98a24 View commit details
  2. Install latest request@2.x.x

    pioug committed Sep 15, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    pioug Gilles Piou
    Copy the full SHA
    e0c9762 View commit details

Commits on Sep 20, 2018

  1. Copy the full SHA
    a39f75f View commit details

Commits on Sep 24, 2018

  1. Merge pull request #115 from atkit/master

    Updated README about supported uid parameter that is used internally for User ID
    jtillmann authored Sep 24, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8ba84c9 View commit details

Commits on Oct 25, 2018

  1. Merge pull request #113 from pioug/package-lock

    Regenerate package-lock.json
    jtillmann authored Oct 25, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e676a15 View commit details
  2. Version 0.4.18

    jtillmann committed Oct 25, 2018
    Copy the full SHA
    0846ead View commit details
Showing with 210 additions and 113 deletions.
  1. +13 −0 HISTORY.md
  2. +24 −1 README.md
  3. +171 −110 package-lock.json
  4. +2 −2 package.json
13 changes: 13 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# History

## 0.4.18

- Fixed package-lock.json bug
- Updated request package

## 0.4.17

- Default to `https` instead of `http` when submitting data to Google Analytics
- Switched from custom debugger to [debug](https://www.npmjs.com/package/debug) module

Deprecated:
- `.debug()` is now deprecated in favor of setting the DEBUG environment variable: `DEBUG=universal-analytics`

## 0.4.16

- Removed async, underscore dependencies
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ A node module for Google's [Universal Analytics](http://support.google.com/analy

This module allows tracking data (or rather, users) from within a Node.js application. Tracking is initiated on the server side and, if required, does not require any more tracking in the browser.

[![Build Status](https://travis-ci.org/peaksandpies/universal-analytics.png?branch=master)](https://travis-ci.org/peaksandpies/universal-analytics)
[![npm version](https://badge.fury.io/js/universal-analytics.svg)](https://www.npmjs.com/package/universal-analytics) [![Build Status](https://travis-ci.org/peaksandpies/universal-analytics.png?branch=master)](https://travis-ci.org/peaksandpies/universal-analytics)


# Table of Contents
@@ -21,6 +21,7 @@ This module allows tracking data (or rather, users) from within a Node.js applic
- [Transaction items](#transaction-item-tracking)
- [Daisy-chaining tracking calls](#daisy-chaining-tracking-calls)
- [Setting persistent parameters](#setting-persistent-parameters)
- [Filter application tracking data](#filter-application-tracking-data)
- [Session-based identification](#session-based-identification)
- [Debug mode](#debug-mode)
- [Request Options](#request-options)
@@ -38,6 +39,9 @@ $ npm install universal-analytics

```javascript
var ua = require('universal-analytics');

// Or with ES6 import
import ua from 'universal-analytics'
```

Initialization expects at least your Google Analytics account ID:
@@ -63,6 +67,13 @@ If you want to use Google Analytics in http protocol, just include it in the opt
var visitor = ua('UA-XXXX-XX', {http: true});
```

If you want to set User Id you can add it into options:
```javascript
var visitor = ua('UA-XXXX-XX', {uid: 'as8eknlll'});
```
[see about User Id](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#uid)


Tracking a pageview without much else is now very simple:

```javascript
@@ -516,6 +527,18 @@ For custom dimensions, you will not pass `dimension#` rather `cd#`:
visitor.set("cd[1-20]", "123456789"); // [1-20] will be the dimension number
```

# Filter application tracking data

Set a persistent parameter for [`Data Source`](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ds) to `app` in order to mark tracking data as `Application`.

```javascript
visitor.set("ds", "app"); // Allows filtering by the 'Application?' field in GA
```

Then create a new view in Google Analytics of type 'Application'. You will then need to filter the data for that view by creating a new filter that either includes or excludes `Application? Yes` (depending on if you want to show(includes) or hide(excludes) application analytics in a given view).

![Google Analytics Setup](https://i.imgur.com/ZDZ3ZPO.png)

# Session-based identification

In order to make session-based apps easier to work with, `universal-analytics` also provides a middleware that works in an Expressjs-style fashion. It will try to detect a client ID based on the `_ga` cookie used by the analytics.js client-side tracking. Additionally it will store the detected client ID in the current session to recognize the visitor later.
281 changes: 171 additions & 110 deletions package-lock.json
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "universal-analytics",
"version": "0.4.17",
"version": "0.4.18",
"description": "A node module for Google's Universal Analytics tracking",
"main": "index.js",
"scripts": {
@@ -18,7 +18,7 @@
],
"dependencies": {
"debug": "^3.0.0",
"request": "2.86.0",
"request": "^2.86.0",
"uuid": "^3.0.0"
},
"devDependencies": {