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

piano-analytics-js

v6.15.2

Published

JavaScript library for Piano Analytics

Downloads

29,549

Readme

About The Project

The Piano Analytics Javascript SDK allows you to collect audience measurement data for the Piano Analytics solution. It works on all javascript environments dedicated to browsers (mostly websites).

This SDK makes the implementation of Piano Analytics as simple as possible, while keeping all the flexibility of the solution. By loading this small library on your platform, and using dedicated and documented methods, you will be able to send powerful events.

It also includes Privacy tagging methods that allow you a perfect management of your tagging depending on the regulation you refer to.

Getting Started

  • Install our library on your project (see below), you have a few possibilities :
    • Using NPM
    • Using our CDN (browser only)
    • Cloning the GitHub project to build a file you will host (browser only)
      • You can use this method if you want to configure your library without additional tagging (ex: like having your site and collect domain already configured in the built file). However, we suggest the NPM method if you use Build Tools (webpack etc.)
  • Check the documentation for an overview of the functionalities and code examples

Using NPM

  1. install our library

    npm install piano-analytics-js --save (--legacy-peer-deps)
    or
    yarn add piano-analytics-js
  2. Configure your site and collect domain in your site/application initialization

    import {pianoAnalytics} from 'piano-analytics-js';
    // for commonJS environment you can do the following
    // const pianoAnalytics = require('piano-analytics-js').pianoAnalytics;
      
      
    // in your initialization
    pianoAnalytics.setConfigurations({
        'site': 123456789,
        'collectDomain': 'https://log.xiti.com'
    });
  3. Send events !

    pianoAnalytics.sendEvent('page.display', // Event name
        {
            'page': 'page name', // Event properties
            'page_chapter1': 'chapter 1' ,
            'page_chapter2': 'chapter 2' ,
            'page_chapter3': 'chapter 3'
        }
    ); 

Using the CDN (browser)

  1. Load the file from our CDN and configure your site and collect domain
    <head>
        <script src="https://tag.aticdn.net/piano-analytics.js"></script>
        <script type="text/javascript">
            pa.setConfigurations({
                site:123456789, 
                collectDomain:'https://log.xiti.com'
            }); 
        </script>
    </head>
  2. Send events
    <body>
     <script type="text/javascript">
         pa.sendEvent('page.display', // Event name
             {
                'page': 'page name', // Event properties
                'page_chapter1': 'chapter 1' ,
                'page_chapter2': 'chapter 2' ,
                'page_chapter3': 'chapter 3'
             }
         ); 
     </script>
    </body>

Using GitHub (browser)

  1. Clone the repo

    git clone https://github.com/at-internet/piano-analytics-js
  2. Install NPM packages

    npm install --legacy-peer-deps
    or
    yarn install
  3. Enter your site and collect domain in src/config.js (optionnal if you want to do it in your implementation)

     'site': 123456789,
     'collectDomain': 'https://log.xiti.com'
  4. Build the file

    npm run build
  5. Get piano-analytics.js in /dist/browser/

  6. Load it and send events

    <head>
        <script src="https://url-to-your-file/piano-analytics.js"></script>
    </head>
    <body>
        <script type="text/javascript">
            pa.sendEvent('page.display', // Event name
                {
                    'page': 'page name', // Event properties
                    'page_chapter1': 'chapter 1' ,
                    'page_chapter2': 'chapter 2' ,
                    'page_chapter3': 'chapter 3'
                }
            );
        </script>
    </body>

Usage

For more examples, please refer to the Documentation

Debugging

If you think there is a bug and are in a development environment, you can build the SDK without it being uglified using the following npm script

npm run rollup:browser

Also, quoting code using this will help us understand your issue

Contributing

Please do not hesitate to contribute by using this github project, we will look at any merge request or issue. Note that we will always close merge request when accepting (or refusing) it as any modification has to be done from our side exclusively (so we will be the ones to implement your merge request if we consider it useful). Also, it is possible that issues and requests from GitHub may take longer for us to process as we have dedicated support tools for our customers. So we suggest that you use GitHub tools for technical purposes only :)

License

Distributed under the MIT License.

Contact

AtInternet a Piano Company - [email protected]