2.1.7 • Published 3 years ago

fx-tracker-web v2.1.7

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

fx-tracker-web

fx-tracker-web is a tool that for some track project.

The library use is install a single code snippet not the event based tracking implementation.To use it, you need to code dt(eventName:string) in everywhere if you need.

We need the navigatore.sendBeacon Web API to send data by default. Of course, some older browsers is not support for this, you can visit the can i use see detail. So,if is not support for the API, we need the xmlhttprequest.

Otherwise if you want to use new Image technology, you can do it by config({useImg:true}),also we are not recommend to do this becouse of the limit of max length of URL in different browsers?.

Install

    npm install fx-tracker-web --save-dev

Example

    import FXTracker from 'fx-web-tracker';

    FXTracker.config({
        host:'https://example.com/track',
        defaultParam:{
            user:{
              username:'username',
              corp_id:'corp_id'
            },
            project: 'fx-code-pc',
            token: 'some token'
        }
    });
    //somewhere do something
    FXTracker.dt('click_save_btn');//send a message to server;
    // some custom params
    FXTracker.dt('other_click',{
      entity:{
        appId:'appId',
        entryId:'entryId',
      },
      custom_params:{
        p1:'p1',
        p2:'p2'
      }
    })

API

  • .config(options:Options) configure the track object.

        host: string;
    defaultParam: Param;
    xhrHeader?: any;
    method?: 'GET' | 'POST';
    useImg?: boolean;
    dtKey?: PropertyKey;
    dateKey?: PropertyKey;
  • .dt(event:string,...args:any[]) Send the message to server when you need it.

  • .configured():boolean It will return a boolean value that tell you is the track object is configured.

2.1.4

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.7

3 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago