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 🙏

© 2026 – Pkg Stats / Ryan Hefner

seo-data-collection-sdk

v1.0.9

Published

Lightweight, privacy-focused JavaScript SDK for collecting comprehensive SEO and website performance data

Readme

SEO Data Collection SDK

A lightweight, privacy-focused JavaScript SDK for collecting comprehensive SEO and website performance data from client websites.

Features

  • 📊 Comprehensive SEO Data Collection

    • Page-level metadata (titles, meta descriptions, headings)
    • Performance metrics (Core Web Vitals)
    • Keyword analysis and content quality
    • User engagement tracking
    • Backlink detection
    • SERP features analysis
    • SEO issues and recommendations
  • 🔒 Privacy-Focused

    • GDPR compliant
    • Consent management
    • Cookie-less option
    • Data anonymization
    • Opt-out mechanism
  • Performance Optimized

    • Async loading
    • Bundle size < 50KB (gzipped)
    • Request batching
    • LocalStorage caching
    • Minimal performance impact
  • 🎯 Developer Friendly

    • Easy integration
    • SPA support
    • Comprehensive documentation
    • TypeScript definitions (coming soon)

Installation

NPM

npm install seo-data-collection-sdk

CDN

<script src="https://cdn.example.com/seo-sdk.min.js"></script>

Manual

Download seo-sdk.min.js from the releases page and include it in your HTML:

<script src="/path/to/seo-sdk.min.js"></script>

Quick Start

Basic Usage

// Initialize the SDK
const seoSDK = new SEODataSDK({
  apiEndpoint: 'https://your-api.com/analytics',
  apiKey: 'your-api-key',
  primaryKeyword: 'your focus keyword',
  privacyMode: 'opt-in', // 'opt-in', 'opt-out', or 'auto'
});

// SDK will automatically start collecting data

With Consent Request

const seoSDK = new SEODataSDK({
  apiEndpoint: 'https://your-api.com/analytics',
  apiKey: 'your-api-key',
  privacyMode: 'opt-in',
});

// Request user consent
seoSDK.requestConsent().then(hasConsent => {
  if (hasConsent) {
    seoSDK.init(); // Start tracking
  }
});

Configuration Options

const config = {
  // Required
  apiEndpoint: 'https://your-api.com/analytics', // Your API endpoint
  apiKey: 'your-api-key', // Your API key

  // Optional
  primaryKeyword: 'seo keyword', // Primary keyword to track
  batchInterval: 30000, // Batch send interval in ms (default: 30s)
  enableHeatmap: true, // Enable mouse movement tracking
  enableScrollTracking: true, // Enable scroll depth tracking
  enableClickTracking: true, // Enable click tracking
  privacyMode: 'opt-in', // Privacy mode: 'opt-in', 'opt-out', 'auto'
};

const seoSDK = new SEODataSDK(config);

API Methods

init()

Initialize and start data collection.

seoSDK.init();

collectData()

Manually trigger data collection.

const data = await seoSDK.collectData();
console.log(data);

send()

Manually send collected data to API.

await seoSDK.send();

getData()

Get current collected data without sending.

const currentData = seoSDK.getData();

setPrimaryKeyword(keyword)

Set or update the primary keyword for analysis.

seoSDK.setPrimaryKeyword('new keyword');

requestConsent()

Show consent banner and request user permission.

const hasConsent = await seoSDK.requestConsent();

hasConsent()

Check if user has given consent.

if (seoSDK.hasConsent()) {
  // User has consented
}

optOut()

Opt out of tracking and stop data collection.

seoSDK.optOut();

destroy()

Clean up and stop all tracking.

seoSDK.destroy();

Data Structure

The SDK collects the following data:

Page Data

  • URL, title, meta description
  • Heading tags (H1-H4)
  • Canonical URL, alternate URLs
  • Word count, text-to-HTML ratio
  • Images (with alt text analysis)
  • Internal and external links
  • Schema markup, Open Graph, Twitter Cards
  • Mobile optimization

Performance Metrics

  • Load time, TTFB
  • First Contentful Paint (FCP)
  • Largest Contentful Paint (LCP)
  • Cumulative Layout Shift (CLS)
  • First Input Delay (FID)

Keyword Analysis

  • Keyword density
  • Keyword locations
  • LSI keywords
  • Content quality metrics
  • Readability score

User Engagement

  • Time on page
  • Scroll depth
  • Bounce rate
  • Click tracking
  • Mouse movements (heatmap)
  • Device and browser info
  • UTM parameters

SEO Issues

  • Missing or problematic meta tags
  • Performance issues
  • Content quality issues
  • Structured data opportunities

Browser Support

  • Chrome 60+
  • Firefox 60+
  • Safari 12+
  • Edge 79+

Privacy & GDPR Compliance

The SDK is designed with privacy in mind:

  1. Consent Management: Built-in consent banner and management
  2. No Cookies: Uses localStorage instead of cookies
  3. Data Anonymization: Can anonymize PII
  4. Opt-out: Easy opt-out mechanism
  5. Transparency: Clear data collection disclosure

Performance Impact

The SDK is optimized for minimal performance impact:

  • Async initialization
  • Lazy loading of heavy features
  • Debounced/throttled event handlers
  • Efficient DOM queries
  • Request batching

Typical performance impact: < 50ms on page load

Development

Build

npm run build

Development Mode

npm run dev

Testing

npm test

License

MIT

Support

For issues and questions, please open an issue on GitHub or contact [email protected]