1.0.0 • Published 5 years ago

finteza-sdk v1.0.0

Weekly downloads
2
License
BSD-3-Clause
Repository
github
Last release
5 years ago

Finteza Node.JS SDK

The official sdk for sending events to Finteza servers and proxying analytical requests via the website.

Also worked with TypeScript.

Requirement

  • Node.JS 8+

Installation

Use the NPM package manager to install SDK easily.

Run the following command from the console:

npm i --save finteza-sdk

Usage

Sending events

Use the sendEvent function to send events to Finteza

Inputs:

ParameterTypeDescription
name *stringEvent name. The maximum length is 128 symbols.
websiteId *stringWebsite ID. It can be obtained in the website settings (ID field) of the Finteza panel.
urlstringOptional. Finteza server address.
refererstringOptional. Host of a website SDK is called on.
valuenumberOptional. Additional parameter value.
unitstringOptional. Additional parameter measurement units, for example, USD, items, etc. The maximum length is 32 symbols.

Example:

const finteza = require("finteza-sdk");

// sending event
finteza.sendEvent({
  name: "Server Track Test",
  websiteId: "sbnonjcmrvdebluwjzylmbhfkrmiabtqpc"
});

See Finteza help for more details on sending events.

Proxying analytical requests

Use the createProxyMiddleware function to create middleware for proxy all analytical requests to Finteza

Inputs:

ParameterTypeDescription
path *stringStart of the path for requests to be proxied.
token *stringToken for signing the X-Forwarder-For header. You can get this value in the website settings (ID field) of the Finteza panel.
urlstringOptional. Finteza server address.
timeoutnumberOptional. Timeout for proxy requests. Default: 15000 ms

Example:

const path = require("path");
const express = require("express");
const finteza = require("finteza-sdk");

const app = express();

app.use(
  finteza.createProxyMiddleware({
    token: "dahhihvyvtjgsbdrdahhihvyvtjgsbdr",
    path: "/fz/"
  })
);

// ...

app.listen(8080);

This middleware sorts out incoming requests on its own and proxies only analytical requests to the Finteza servers.

Also, Finteza counter code installed on the website should be changed for correct operation.

See Finteza help for more details on configuring proxying.

License

Released under the BSD License.