3.0.0 • Published 5 years ago

@userdive/agent v3.0.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
5 years ago

@userdive/agent

npm version Build Status styled with prettier

Build Status

Official USERDIVE module for webpage analytics

Table of Contents

Install

npm install @userdive/agent --save

Usage

Basic Usage

import Agent from "@userdive/agent";

const agent = new Agent("projectId", "auto");
agent.send("pageview");

Custom Dimensions

docs

import Agent from "@userdive/agent";

const agent = new Agent("projectId", "auto");
agent.send("pageview", {
    dimension15: "My Custom Dimension"
});
agent.set({
    dimension15: "My Custom Dimension"
});

agent.set("dimension15", "My Custom Dimension");

Send Event

import Agent from "@userdive/agent";

const agent = new Agent("projectId", "auto");
agent.send("pageview");
agent.send("event", {
    eventCategory: "EC",
    eventAction: "Cart",
    eventLabel: "add",
    eventValue: 2000
});

Register Plugin ( in plugin code )

class MyPlugin {
    constructor(agent, opts) {
        this.opts = opts || { msg: "hi" };
    }

    greeting(target) {
        const name = target || "user";
        console.log(this.opts.msg + ", " + name);
    }
}

Use Plugin

import Agent from "@userdive/agent";
import Myplugin from "path/to/plugin";

const agent = new Agent("projectId", "auto");
agent.provide("myplugin", MyPlugin);
agent.require("myplugin", { msg: "hello" }); // provided name
agent.run("myplugin", "greeting", "everyone");
// => output 'hello, everyone'

Contribute

PRs accepted. join us

License

GPLv3. Full license text is available in LICENSE

3.0.0

5 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.15.0

6 years ago

0.14.0

6 years ago

0.13.0

6 years ago

0.12.1

6 years ago

0.11.0

6 years ago

0.10.0

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.0

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago