Giter Club home page Giter Club logo

meteor-google-analytics's Introduction

@iDoMeteor's Google Analytics Meteor Package v0.0.1

Synopsis

First attempt at a real package, loading locally works right now, loading remotely from http://google-analytics.com/analytics.js is not working in this version (not really my priority). The drop-in code with working remote loading & official Google debugging goodies will be made available after I get it running very cleanly within #OnePageWonder.

I will migrate those changes to this package shortly thereafter, but to do so I am going to have to perform some wizardry that I don't have head space for just now. :)

  • You can diff or hash my real-google-analytics.js w/the one from the link above, it is unchanged. :>

Usage

Installation

meteor add idometeor:google-analytics

To configure:

Set Meteor.settings.public.google in settings.json

Usage (client):

gaEvent(category, action, label, debug);
           (string, string, string, boolean)
gaPageview(relative_url);
              (string, boolean)

Reference: https://developers.google.com/analytics/devguides/collection/analyticsjs

Settings

{
  "public": {
    "google": {
      "account": "UA-23671882-14",
      "cookie": {
        "auto": "true",
        "domain": "false",
        "expires": "false",
        "name": "false",
        "localMode": "false"
      },
      "debug": "false",
      "enable": "true",
      "trackInPage": "false",
      "trackInterests": "false"
    }
  }
}
  • There are a few more options in the upcoming drop-in.

Example

I built up a (quick) example based on the official Meteor skeleton that is installed when you meteor create app:

Extended Notes

The whole purpose of writing this was to figure out a way to not use Meteor.settings (I prefer to have things like this in a database so that people who don't code can change them and I don't have to do it for them). The drop-in version works great, but the package version.. has ended up almost like the version it was intended to replace (you will be able to tell by the drop-in that this is based on that code and not GAnalytics package, but this package ended up quite similar). Therefore, I have stripped it of rank and bumped the version all the way back to 0.0.1! lol

Also, I killed the value and data options on the event sending, they are right next to useless.

The drop-in successfully works loading from any of the three sources (local, remote, remote debug). I think to get this doing everything I want, I may have to read some Meteor source code for a week. :D

I will figure it all out eventually! :D

Caveat

You may need to tune your browser policy code, especially if you turn on trackInterests which will do all sorts of stuff with Doubleclick that will crank your load time way up. Is it worth losing traffic just let someone else analyse your consumers' shopping trends? No.

Bonus:

The one thing this does do right, is load the analytics.js locally, saving an insane amount of loading time. Seriously.

meteor-google-analytics's People

Contributors

idometeor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.