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

tap-turtle

v0.0.7

Published

Event collection platform for DOM snapshots, mouse movements, and clicks

Downloads

40

Readme

Tap-Turtle 🐢

npm version

Tap-Turtle is a lightweight event-collection platform that tracks DOM snapshots, mouse movements, clicks, and scroll events on a web page. It batches these events and sends them to a backend server for analysis, similar to tools like PostHog. It's super easy to integrate into any React application!

Features

  • DOM Snapshot on Load: Capture the initial DOM structure when the page loads.
  • Mouse Movements: Track mouse movements on the page.
  • Click Events: Record every click event with coordinates and the target element.
  • Scroll Tracking: Monitor scroll events and capture the scroll position.
  • Event Batching: Events are sent in batches every 5 seconds to reduce network overhead.
  • Simple Integration: Just wrap your app with the TapTurtleProvider and provide your project key. No additional hooks needed!

Installation

You can install tap-turtle via npm:

npm install tap-turtle

or via Yarn:

yarn add tap-turtle

Usage

Integrating tap-turtle into your React app is simple! Just wrap your app with the TapTurtleProvider and pass in your projectKey.

Example

import React from "react";
import { TapTurtleProvider } from "tap-turtle";

const App: React.FC = () => {
  return (
    <TapTurtleProvider projectKey="YOUR_PROJECT_KEY">
      <div>Your Application Content</div>
    </TapTurtleProvider>
  );
};

export default App;

This will automatically:

  • Capture the initial DOM snapshot on page load.
  • Start collecting mouse movements, click events, and scroll events.
  • Batch and send the collected events to your backend every 5 seconds.

Configuration

The only required prop is the projectKey, which will be used to identify different projects.

<TapTurtleProvider projectKey="YOUR_PROJECT_KEY">
  {/* Your app content */}
</TapTurtleProvider>

Backend Integration

The events are sent as a POST request to the endpoint http://localhost:5001/events/save. You can modify this endpoint in future releases to suit your backend requirements.

The payload contains the sessionId, a unique identifier for each session, and the list of events:

{
  "sessionId": "unique-session-id",
  "events": [
    {
      "type": "click",
      "x": 150,
      "y": 200,
      "target": "DIV",
      "timestamp": 1628512800000
    },
    {
      "type": "mousemove",
      "x": 300,
      "y": 400,
      "timestamp": 1628512805000
    },
    {
      "type": "scroll",
      "scrollX": 0,
      "scrollY": 500,
      "timestamp": 1628512810000
    }
  ]
}

Customization (Upcoming)

In future versions, the following features will be added:

  • Custom event types (e.g., keypress, form submissions)
  • Custom backend endpoints
  • Configurable batch intervals

Development

If you'd like to contribute to tap-turtle or run the project locally, follow these steps:

  1. Clone the repo:
git clone https://github.com/your-username/tap-turtle.git
cd tap-turtle
  1. Install dependencies:
npm install
  1. Build the package:
npm run build
  1. Run the project in development mode:
npm start