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

react-page-clicks

v1.0.10

Published

capture and monitor all your customer's interactions(clicks, mouseover, mouseout, page clicks..) on your react website.

Downloads

48

Readme

react-page-clicks

capture and monitor all your customer's interactions(clicks, mouseover, mouseout, page events..) on your react website and post it to rest endpoint for analytics and metrics.

NPM JavaScript Style Guide

Install

npm install --save react-page-clicks

Usage

Basic Example:

import React, { Component } from 'react'

import ReactPageClicks from 'react-page-clicks'

class Example extends Component {
  render () {
    return (
      <ReactPageClicks>
        <App/>
      </ReactPageClicks>
    )
  }
}

Running the Example

//step 1 : Clone the repository
git clone https://github.com/vijay122/react-page-clicks.git
//step 2 : Switch to examples folder
cd example
//steo 3 : install dependencies and start the example project
npm install
npm start

goto port http://localhost:3000/
you can see the example site up and running with the react-page-clicks plugin enabled.
open console in devtools and check the interaction logs for every click and mouse over on the products.

alt <a>https://github.com/vijay122/react-page-clicks/blob/master/example/react-page-clicks-example-setup.gif</a>

this will open the example website in a new tab running on port http://localhost:3000/ as below:

alt <a>https://github.com/vijay122/react-page-clicks/blob/master/example/example-site.gif</a>

here for example, i have logged the webpage interactions to the console. this can be pushed to any rest api exposed by passing the endpoint attribute to the react-page-clicks plugin..

Pushing captured logs:

All page events and its corresponding data in different sub-pages are captured in the page object. When the page is getting removed from the dom, ie, whenever the page is closed by the close button on the browser, or refreshed (ctrl + f5) the logs will be posted to the endpoint url passed as props to the react-page-clicks.

Enjoy!!.

Advanced Example:

import React, { Component } from 'react'

import ReactPageClicks from 'react-page-clicks'

class Example extends Component {
  render () {
    return (
      <ReactPageClicks
               interactionElement={'container'}
               endpoint={'http://analyticsapi.com/save'}
               captureAttributes={['id', 'name', 'class', 'text']}>
               <div className={'container'}>
                 <Website />
               </div>
             </ReactPageClicks>
    )
  }
}

Configuration Props

By passing the below props, you can specify additional features to the react-page-clicks, these props are availed.

| Props | Description | | --- | --- | | interactionElement | The container dom element on the webpage, inside which all the interactions are to be recorded. usually the interactionElement is the root element or the first div element on the webpage. In the example above, interaction element is passed as 'container' because the first child element inside our plugin is div, and its class name is 'container' react-page-clicks accepts only class name as interactionElement, to identify the root element. | | endpoint | Most of the time, analytics has to be saved to a temporary database for the data scientists to study the data. This is the rest http endpoint, to which the captured interactions are to be posted to. By passing a valid rest api accepting post, the user interaction logs/clickstream logs can be posted directly to the provided api from react-page-click In the example above, i have used a dummy url, to show the format 'http://analyticsapi.com/save'. | | captureAttributes | These are the core data/attributes which has to be captured in an interaction. In your web application, if you are using any custom attributes to contain data, like 'prd-id', 'text-value', then if all these values has to be captured in the interaction, these has to be passed to the react-page-clicks inside captureAttributes Example captureAttributes=['prd-id','text-value'], will capture if the control has a prd-id attribute and record them to the response. |

License

MIT © vijay122