Skip to content

peteristhegreat/statcounterjs

Repository files navigation

statcounter

StatCounter analytics for nodejs + react + typescript

NPM JavaScript Style Guide

Install

npm install --save statcounter

Usage

In your top level component, add the StatCounter component near the end.

import React, { Component } from 'react'

import StatCounter from 'statcounter'

const App = () => {
  render() {
    return (
      <>
        <Component {...pageProps} />
        <StatCounter sc_project={12345678} sc_security="abcd1234" />
      </>
    )
  }
}

And you are done! I haven't checked all possible values for the image_url. It looks like it tends to be the format:

https://c.statcounter.com/${sc_project}/0/${sc_security}/1/

If you find your statcounter project is on a different subdomain for the image url for whatever reason, add in the sc_image_url prop:

<StatCounter 
    sc_project={12345678} 
    sc_security="abcd1234" 
    sc_image_url="https://c.statcounter.com/12345678/0/abcd1234/1/">
</StatCounter>

License

MIT © peteristhegreat

About

Statcounter analytics for nodejs + typescript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published