Javascript
Before I start
Piano Analytics SDKs have been designed for the Piano Analytics solution. Data sent through these SDKs will not be processed within the Analytics Suite 2.
attention
If your Analytics perimeters are certified (ACPM / Mediamétrie), you still need to use the SmartTag SDKs (at least for your pages).
"xtor" marketing campaigns syntax will not be recognized anymore. Please use "at_" instead.
Load the library
The first step to use our SDK is to load the JS file. You have two ways to do this:
CDN
You can load the library from https://tag.aticdn.net/piano-analytics.js
:
<script type="text/javascript" src="https://tag.aticdn.net/piano-analytics.js"></script>
Download
You can also download the file from Github and upload it on your own server.
Configuration
In order to setup your tracking, you need to set the configuration of the library:
pa.setConfiguration(configurationKey, configurationValue);
// or
pa.setConfigurations(configurationObject)
tip
We recommend setting the configuration within the <head>
of your page.
Here is the minimal configuration required:
pa.setConfiguration("site", 123456789); // your site id
pa.setConfiguration("collectDomain", "https://log.xiti.com"); // your collection domain
// or
pa.setConfigurations({
site: 123456789,
collectDomain: "https://log.xiti.com"
});
note
Don't hesitate to read our collection methods article to find the collection domain that has been assigned to you.
You can also use a custom domain thanks to our CDDC.
Here are the available configurations:
Category | Name | Description | Type | Value | More info |
---|---|---|---|---|---|
Global | collectDomain | Collection domain | string | https://examplelog.xiti.com | View |
Global | site | Site id | int | 123456789 | View |
Global | path | Request path | string | event | |
Global | addEventURL | Automatically adds a page_url property to all events, containing the URL of the current page | string | false , withoutQS (default), true | |
Global | cookieDomain | Domain of cookie deposit | string | mysite.com (current domain by default) | |
Global | cookieSameSite | "SameSite" flag in cookies in client-side | string | lax (default), none , strict | |
Global | cookieSecure | "Secure" flag in cookies in client-side cookies | boolean | true (default), false | |
Global | encodeStorageBase64 | Storage value encode (base64) | boolean | true , false (default) | |
Privacy | sendEventWhenOptout | Do you want to send events when optout? | boolean | true (default), false | |
Privacy | privacyDefaultMode | Privacy mode by default | string | optin (default) | View |
Storage | storageLifetimePrivacy | Lifetime Storage Privacy value | int | 395 (days) | View |
Storage | storageLifetimeUser | Lifetime Storage User value | int | 395 (days) | View |
Storage | storageLifetimeVisitor | Lifetime Storage Visitor value | int | 395 (days) | View |
Storage | visitorStorageMode | Relative or fixed cookie lifetime value for visitor | string | fixed (default), relative | |
Campaign | campaignPrefix | Choose with an order of priority the type of campaign to be collected | array | ['at_'] | View |
Campaign | enableUTMTracking | UTM parameters collected as properties | boolean | true (default), false | View |
Visitor Policy | isVisitorClientSide | Is cookie deposit client side ? If false , server side | boolean | true (default), false |
Specification
Piano Analytics Javascript SDKs are based on the sendBeacon
browser API.
Please refer to the documentation if you want more information.
Changelog
You can find the Javascript changelog directly on GitHub.