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

@youseedk/tracking

v0.0.10

Published

## Installation

Downloads

8

Readme

YouSee Tracking

Installation

npm i @youseedk/tracking

Initialization

From JavaScript

import ysTracking from '@youseedk/tracking';

ysTracking.init({
  pageName: 'Page Name',
  pageType: 'Sales Page / Article / Application',
  siteSections: ['site', 'section', 'its', 'in'],
  linkitId: '', //the linkit id associated with logged in user or blank
}, 'prod'); // 'dev' or 'prod' defaults to 'dev'

From index.html (with express proxy)

First you would have to configure your express server e.g. for a CRA (Create React App) you will have to create/edit your setupProxy.js file located in the src folder

const path = require("path");

module.exports = function (app) {
  app.use("/tracking", function (req, res) {
    res.sendFile(
      path.resolve(
        __dirname + "/../node_modules/@youseedk/tracking/dist/index.js"
      )
    );
  });
};

After you created the route on your express server, you will have to add the following snippet at the end of your <body> in the index.html to run the initialization for the tracking library.

<script
  src="/tracking"
  onload="trackingInit({
    pageName: 'NEW TRACKING TESTING - JS',
    pageType: 'Sales Page / Article / Application',
    siteSections: ['site', 'section', 'its', 'in'],
    linkitId: 'TEST',
  })"
></script>

or

<script>
  (function (d, s, id, el) {
    if (d.getElementById(id)) { return; }
    el = d.createElement(s);
    el.type = "text/javascript";
    el.onload = function () {
      trackingInit({
        pageName: "NEW TRACKING TESTING - JS",
        pageType: "Sales Page / Article / Application",
        siteSections: ["site", "section", "its", "in"],
        linkitId: "TEST",
      });
    };
    el.src = "/tracking";
    d.getElementsByTagName("head")[0].appendChild(el);
  })(document, "script", "youseedk-tracking");
</script>

NOTE: You could use the tracking from a CDN but it might trigger later then some track or view calls

Optional params

One can supply several other parameters:

e.g.

ysTracking.init(
  data,
  "dev", // Environment (dev | prod) - defaults to "dev"
  true, // isSinglePage - boolean value
  "tdc-group", // Tealium account - defaults to "tdc-group"
  "yousee", // Tealium profile - defaults to "yousee"
)

NOTE1: Do not set/change the account and the profile if not needed

NOTE2: if isSinglePage (SPA) attribute is set to true, you will have to manually supple the page views manually (LINK TO VIEW DOCUMENTATION)

Track

import ysTracking from '@youseedk/tracking';

ysTracking.track(
  'ComponentName',
  'Loaded',
  {
    ecPopUp: ['One', 'Two']
  }
);

NOTE1: If using TypeScript you can import the UtagLinkData to get type definition for the third parameter.

NOTE2: Parameters can be overwritten entirely on the last argument (for full customization of the tracked object). Though it is not recommended - as one could potentially fail critical type checks doing in in this manner.

import { UtagLinkData } from '@youseedk/tracking';

View

This method should be used when running your application as a SPA. In order to set the tracking for the SPA mode you will have to do it though the third parameter in the init() call. You should use this method for tracking page changes.

import ysTracking from '@youseedk/tracking';

ysTracking.view(data);

NOTE: If using TypeScript you can import the UtagViewData to get type definition for the third parameter.

import { UtagViewData } from '@youseedk/tracking';