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

identity-rentpath

v3.0.1

Published

Allocate and track a universal Rentpath ID using the Personalization service as a backend.

Downloads

4

Readme

Build Status Commitizen friendly semantic-release npm version

Track a Universal RentPath Identity

For Javascript Developers

If you are a JavaScript developer and regularly use open source libraries, adding a RentPath Universal Identity (RUID) to your site requires little effort. The bulk of work is already captured in this library. In most cases, integration requires just two small snippets of code.

Copy and paste the following snippets into your Web site so that each page view executes the code. For example, you might embed the code in a header, footer, or some other element that is rendered within every page of your site.

<script async type="text/javascript"
  src="https://www.rentpathcode.com/identity/x.y.z/identity.min.js">
</script>

<script>
  window.Identity = window.Identity || [];

  function report() {
    var id = this.universal_zid.uuid;
    window.Identity.push(['cookify', id]);
    window.Identity.push(['pixel', window.location.href]);
  }

  window.Identity.push(['fetch', report, function (){}]);
</script>

The first script tag above loads the RentPath Identity library from a CDN. Please replace the x.y.z in the src with the version number of the latest release of the library. To find the latest release, run the command...

$ npm view identity-rentpath versions

The second script tag above creates an RUID (if one has not already been saved as a cookie) and sends tracking information, including the RUID, your hostname, and the complete URL of the current page, to our servers.

To test operation, open your application (perhaps after a server restart or cache purge to pick up the new JavaScript code) and look in the Cookies section of your browser’s development tools. If you see a new cookie named uzid, tracking is operational.

Packaging via npm

If you use Javascript packaging tools such as webpack to manage your library dependencies, you can include the RUID library via the manifest, package.json.

Install RUID with the command:

$ npm install identity-rentpath --save-dev

 

For Developers with Existing Google Tag Manager Tags

If your site manages page content with Google Tag Manager (GTM), adding a RentPath Universal Identity (RUID) is quite simple. Specifically, two new tags are needed: one tag to load the RUID JavaScript library, and a second to create the RUID (if necessary) and track its use. Both tags must appear and fire on all pages on your site.

To begin, open your GTM console and create the tag to load the library.

  1. Click New Tag.

  2. On the next screen, click at top and name the tag Load RUID Library.

  3. When asked to choose a type for the tag, select Custom HTML Tag.

  4. Copy and paste the following code into the configuration text box:

<script async
  type="text/javascript"
  src="https://www.rentpathcode.com/identity/x.y.z/identity.min.js">
</script>
  1. Replace the x.y.z with the version number of the latest release of the library. You can use npm view to list all available versions (see the command to use in the first section) or browse the releases on this repository’s Github releases page.

  2. Choose the trigger to Fire on All Pages.

  3. Save the tag.

Next, create the tag to create and track the RUID.

  1. Click New Tag.

  2. Name this tag Track RUID.

  3. Choose Custom HTML Tag again.

  4. Copy and paste this piece of code:

<script type="text/javascript">
  window.Identity = window.Identity || [];

  function report() {
    var id = this.universal_zid.uuid;
    window.Identity.push(['cookify', id]);
    window.Identity.push(['pixel', window.location.href]);
  }

  window.Identity.push(['fetch', report, function (){}]);
</script>
  1. Again, choose a trigger to Fire on All Pages.

  2. Save the tag.

Finally, open a container that is present on each page of your site, add both the Load RUID Library and Track RUID tags you just created, and publish the new version of the container.

Once published, the tracking code should work immediately.

For RUID Library Developers

The RentPath Universal Identity is implemented as an ES6 library.

Getting Started

$ git clone [email protected]:rentpath/identity.js.git
$ npm install
$ npm start

#
# Open http://localhost:5000 in a browser.
# Chrome typically works best for debugging.
# The default page shown is src/index.js.
...

Linting

Before you commit any new code, scan your JS with ESLint.

$ npm run lint

Testing

Automated tests poke and prod the entry points to the library. Karma is the test runner. The default test runner executes the tests only once, which is ideal for CI (Travis and such).

$ npm run test

The next command automatically monitors all files for changes and reruns the tests. This command is ideal for active development.

$ npm run test_watch

Bundling

To prepare code for a release, process the library to convert the ES6 into widely usable (read: antique) Javascript. Two commands perform the work:

$ webpack --debug --devtool sourcemap --output-pathinfo --config webpack.config.js
$ webpack --config webpack.config.production.js

The first use of webpack generates files ./dist/identity-version.js and ./dist/identity-version.js.map, where version is a string like 1.1.0 defined by semantic versioning. The second command produces ./dist/identity-version.min.js and ./dist/identity-version.min.js.map.

Releasing New Code

Code changes are automatically versioned and released to npm and Github using a combination of semantic-release, commitizen, and Travis.

If the master branch passes all tests, it is packaged in three forms and sent to npm, Github, and S3, respectively.

References