0.1.10 • Published 3 months ago

@gotipath/analytics v0.1.10

Weekly downloads
-
License
ISC
Repository
-
Last release
3 months ago

Tracker - GotipathAnalytics

This is the web client used to track page and media events of websites for the Gotipath Analytics.

Installation

Install the package using npm or yarn:

npm i @gotipath/analytics
or
yarn add @gotipath/analytics

Usage

Follow the steps below to use the package.

React/Next.js

// layout.tsx
import { initTracking } from '@gotipath/analytics';

initTracking({
    trackingUrl: 'http://<organization>.analytics.gotipath.com/tracking/v1/<project-id>/<platform-id>',
    debugMode: true,
});

Media tracking is done by adding the following code to the player component:

// player.tsx
import { addPlayer, removePlayer } from '@gotipath/analytics/media';
import { useEffect, useRef } from 'react';

export function YourPlayer({ video }: Props) {
    const playerRef = useRef(null);

    useEffect(() => {
        if (!playerRef.current) return;
        const analPlayer = addPlayer(playerRef.current);

        return () => {
            removePlayer(analPlayer);
        };
    }, [playerRef.current]);

    return (
        <>
            <video
                ref={playerRef}
                width="800"
                height="450"
                data-media-id={video.id}
                data-media-type="movies"
                title={video.title}
                src={video.src}
                poster={video.poster}
                controls
                autoPlay
            ></video>
        </>
    );
}
0.1.10

3 months ago

0.1.8

3 months ago

0.1.7

3 months ago

0.1.9

3 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago