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

clicky-loader

v0.1.1

Published

A modern CommonJS loader for Clicky

Downloads

11

Readme

Clicky Loader

This is a library designed to wrap, load, and patch JavaScript for Clicky for apps that use CommonJS module loaders like Browserify or Webpack.

Because of the way Clicky's JavaScript is traditionally loaded, your single-page app must either wait for window.clicky to be populated to log the current URL/page title, goals, or custom data.

This library will load the clicky JavaScript asynchronously and queue any calls from your application to Clicky's own JavaScript until it is loaded, at which point it will make any necessary calls.

The benefit of this approach is that your JavaScript application can make any calls it needs to using this library as a proxy, without needing to check if Clicky has loaded yet. This can reduce your application's loading speed, especially if you are loading Clicky synchronously or otherwise waiting to initialize your application until it is loaded.

Additionally, Clicky's use of global variables such as clicky_custom to log custom data works well with traditional web apps, but does not make much sense for single-page apps. As such, setVisitorData has been patched into the Clicky object to allow easier updating of custom data.

Installation

npm install clicky-loader

Usage

In any module you want to log data to Clicky:

var clicky = require('clicky');

clicky.init(YOUR_SITE_ID);

clicky.log(window.location.hash, 'Page Title', 'pageview');
clicky.goal('The user did something!');

Public API

  • init(siteId) - initialize clicky with your site ID
  • log(href, title, type) - the current href, page title, and action type ( one of click (default), pageview, download, outbound)
  • setVisitorData(object) - sets window.clicky_custom.visitor with the object you provide
  • isLoaded() - whether Clicky has loaded yet