Sending events

The SDK allows sending any events from the server part of your website to Finteza, including user action data, database status, performance indicators, etc.

Call the ITracker.SendEvent method. For this purpose, obtain the ITracker implementation using Dependency Injection. For example, this can be done using the following injection into the constructor:

class SomeClass
{
    public SomeClass(ITracker tracker)
    {
        tracker.SendEvent("{EVENT}""{REFERER}");
    }
}

Using the SendEvent method, you can register the events and pass additional information as parameters, for example, a type of a purchased good, price, currency, etc. The following parameters are supported:

Parameter

Type

Description

name *

string

Event name. The maximum length is 128 symbols.

referer *

string

The address of the page from which the event is sent. All events are bound to counters (websites) on Finteza side using the websiteId. The system makes sure that a host an event has arrived from corresponds to the counter host (specified in the website settings of the Finteza panel). This prevents inflating traffic.

backReferer

string

The address of a web page a visitor was located at before performing a tracked action.

userIp

string

The IP address of the visitor who performed a tracked action.

userAgent

string

The user-agent of the visitor who performed a tracked action.

unit

string

Parameter measurement units, for example, USD, items, etc. The maximum length is 32 characters.

value

string

The value of the parameter. The maximum length is 64 symbols.

* – required parameters.

Example:

tracker.SendEvent("Server Track Purchase""https://www.mysite.com""USD""100");

There is no need to specify the referer parameter each time the event is sent, if you set its default value during initialization. During AddFintezaAnalytics call, specify the additional parameter DefaultReferer:

services.AddFintezaAnalytics(options =>
{
    options.WebsiteId = "{WEBSITE_ID}";
    options.DefaultReferer = "{DEFAULT_REFERER}";
...
});

Note: If you do not use DefaultReferer,  specify referer during each SendEvent call. Otherwise, the events will not be sent.


Another variant is available for the ITracker.SendEvent function:

tracker.SendEvent({CONTEXT}"{EVENT}");

Instead of the explicit specification of referer, backReferer, userIp, userAgent, here the request execution context is specified, from which the specified parameters will be received and sent to Finteza.

Parameter

Type

Description

httpContext *

Microsoft.AspNetCore.Http.HttpContext

Current HTTP request execution context, from which parameters referer, backReferer, userIp and userAgent are automatically formed.

name *

string

Event name. The maximum length is 128 symbols.

unit

string

Parameter measurement units, for example, USD, items, etc. The maximum length is 32 characters.

value

string

The value of the parameter. The maximum length is 64 symbols.

* – required parameters.