How to install a tracking script
To add a tracking script, simply insert a small code into your website pages. Open your website in the Finteza panel and go to Settings:
Copy the tracking code and paste it to all website pages inside the <head></head> tags.
If you have not registered your website in Finteza already, click Add in the Websites section. Specify website name and address to immediately receive a tracking code. |
|
Be sure to insert the tracking code in all pages of your website, otherwise the visits statistics will be incomplete. |
Example #
Insertion code looks as follows:
<script type="text/javascript">
|
In the copied code, {SCRIPT_URL} is to be replaced with URL address of the main tracking script downloaded from the Finteza server. {WEBSITE_ID} is to be replaced with your website ID in the Finteza panel.
After inserting the code, the fz() function appears in the main context window of the web page. To check its availability, execute window.fz in the console. This function is used to call the methods for interacting with Finteza. Example of registering a website:
fz("register","website","{WEBSITE_ID}"); |
If the name for the fz function is already occupied, use another one. To do this, change the method declaration and call in two places in the tracking code:
(window,document,"script","{SCRIPT_URL}","fz-your-name");
|
The main tracking script (downloaded from the Finteza server) is inserted into the page asynchronously – independently of other elements. Thus, it does not slow down the loading of the main page.
Website registration parameters #
The insertion code includes calling the fz("register", ...) function that sends website visit events to Finteza. This function supports several additional parameters:
Parameter |
Type |
Description |
---|---|---|
trackHash |
boolean |
Enable web page hash (anchor) change tracking.
Enable this parameter to let Finteza track hash changes in the web page URL. A new web page visit event will be sent to the system each time the hash is changed. |
trackLinks |
boolean |
Enable tracking clicks on external links located on your website pages.
If you use multiple external links on the website (for example, when collaborating with an advertising network), this parameter allows you to determine exactly how users leave the website.
Each time an external link is clicked, a special event is sent to Finteza. Report on such events is available in the Pages – Exits section of your website of the Finteza panel. |
timeOnPage |
boolean |
Enable accurate calculation of time spent by a user on a web page.
By default, the parameter is calculated as a difference between entry and internal transition time. However, such a calculation is impossible for the last visited page since there is no transition to the next internal web page.
If enabled, JavaScript Client sends a special event to Finteza informing that the user is still on the web page every 15 seconds. Thus, you can more accurately track the spent time even for single views.
The events are sent only the first two minutes the user spends on the web page. |
Example of enabling additional parameters:
fz( "register", "website", {
|
When using Content Security Policy #
Content Security Policy standard has been designed to prevent attacks associated with the introduction of malicious code into website pages. If you use this security policy, add an exception for the website the Finteza tracking script is downloaded from into the string with the corresponding declaration in each web page header, for example:
Content-Security-Policy: script-src 'self' content.mql5.com; |
Otherwise, browsers will block core.js loading, thus disabling website statistics collection.
Accelerating download using X-DNS-Prefetch-Control #
To accelerate the tracking script download, it is recommended to add the X-DNS-Prefetch-Control instruction to the header of all website pages:
<meta http-equiv='x-dns-prefetch-control' content='on'>
|
It shows the script location to the browser, so that it can resolve the address immediately (when downloading the web page) without spending time on that when downloading the script itself.
Proxying the script download via your website #
To avoid Finteza script download being blocked, it is recommended to proxy it via your websites.