npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

unomi-analytics

v1.0.10

Published

The Apache Unomi analytics.js integration.

Downloads

257

Readme

Apache Unomi Web Tracker Javascript Library

This is the web tracker for apache-unomi ( http://unomi.apache.org/ )

This package can be used in a Javascript application to interact with Apache Unomi.

Getting started

Adds tracker to your app :

npm add unomi-analytics

Then

unomiTracker.initialize({
     'Apache Unomi': {
         scope: 'my-app',
         url: 'http://unomi:8181',
     }
 });
 
unomiTracker.ready(function() {
    console.log("Unomi context loaded - profile id : "+window.cxs.profileId + ", sessionId="+window.cxs.sessionId);
});

Implicit page view event

In the initialize call, the tracker will generate an implicit page view event, which by default will be populated with the following information:

    window.digitalData.page = window.digitalData.page || {
        path: location.pathname + location.hash,
        pageInfo: {
            pageName: document.title,
            pageID : location.pathname + location.hash,
            pagePath : location.pathname + location.hash,
            destinationURL: location.href
        }
    }

Now if you want to provide your own custom page information for the initial page view, you can simply do it like this:

    unomiTracker.initialize({
            scope: 'myScope',
            url: 'http://unomi:8181', // we use an empty URL to make it relative to this page.
            initialPageProperties: {
                path: path,
                pageInfo: {
                    destinationURL: location.href,
                    tags: ["tag1", "tag2", "tag3"],
                    categories: ["category1", "category2", "category3"]
                },
                interests: {
                    "interest1": 1,
                    "interest2": 2,
                    "interest3": 3
                }
            }
        });

Also note that the FIRST call to unomiTracker.page() will be IGNORED because of this initial page view. This is the way that the Analytics.js library handles it. So make sure you are aware of this when calling it. This is to avoid having two page views on a single call and to be compatible with old versions that did use the explicit call.

Sending events

Here are some examples of sending events :

unomiTracker.page() // first call will be ignored as the initial page load is done in the initialize method

unomiTracker.identify({
    nickname: 'Amazing Grace',
    favoriteCompiler: 'A-0',
    industry: 'Computer Science'
});

unomiTracker.track('articleCompleted', {
    title: 'How to Create a Tracking Plan',
    course: 'Intro to Analytics'
});

As the Unomi Tracker uses the Analytics.JS API, you can find more information about it here. All methods can be used on unomiTracker object, although not all event types are supported by Unomi integration.