
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
piano-analytics-js
Advanced tools
The Piano Analytics Javascript SDK allows you to collect audience measurement data for the Piano Analytics solution. It works on all javascript environments dedicated to browsers (mostly websites).
This SDK makes the implementation of Piano Analytics as simple as possible, while keeping all the flexibility of the solution. By loading this small library on your platform, and using dedicated and documented methods, you will be able to send powerful events.
It also includes Privacy tagging methods that allow you a perfect management of your tagging depending on the regulation you refer to.
install our library
npm install piano-analytics-js --save (--legacy-peer-deps)
or
yarn add piano-analytics-js
Configure your site and collect domain in your site/application initialization
import {pianoAnalytics} from 'piano-analytics-js';
// for commonJS environment you can do the following
// const pianoAnalytics = require('piano-analytics-js').pianoAnalytics;
// in your initialization
pianoAnalytics.setConfigurations({
'site': 123456789,
'collectDomain': 'https://<xxxxxxx>.pa-cd.com'
});
Send events !
pianoAnalytics.sendEvent('page.display', // Event name
{
'page': 'page name', // Event properties
'page_chapter1': 'level 1' ,
'page_chapter2': 'level 2' ,
'page_chapter3': 'level 3'
}
);
<head>
<script src="https://tag.aticdn.net/piano-analytics.js"></script>
<script type="text/javascript">
pa.setConfigurations({
site:123456789,
collectDomain:'https://<xxxxxxx>.pa-cd.com'
});
</script>
</head>
<body>
<script type="text/javascript">
pa.sendEvent('page.display', // Event name
{
'page': 'page name', // Event properties
'page_chapter1': 'level 1' ,
'page_chapter2': 'level 2' ,
'page_chapter3': 'level 3'
}
);
</script>
</body>
Clone the repo
git clone https://github.com/at-internet/piano-analytics-js
Install NPM packages
npm install --legacy-peer-deps
or
yarn install
Enter your site and collect domain in src/config.js
(optionnal if you want to do it in your implementation)
'site': 123456789,
'collectDomain': 'https://<xxxxxxx>.pa-cd.com'
Build the file
npm run build
Get piano-analytics.js
in /dist/browser/
Load it and send events
<head>
<script src="https://url-to-your-file/piano-analytics.js"></script>
</head>
<body>
<script type="text/javascript">
pa.sendEvent('page.display', // Event name
{
'page': 'page name', // Event properties
'page_chapter1': 'level 1' ,
'page_chapter2': 'level 2' ,
'page_chapter3': 'level 3'
}
);
</script>
</body>
For more examples, please refer to the Documentation
If you think there is a bug and are in a development environment, you can build the SDK without it being uglified using the following npm script
npm run rollup:browser
Also, quoting code using this will help us understand your issue
Please do not hesitate to contribute by using this github project, we will look at any merge request or issue. Note that we will always close merge request when accepting (or refusing) it as any modification has to be done from our side exclusively (so we will be the ones to implement your merge request if we consider it useful). Also, it is possible that issues and requests from GitHub may take longer for us to process as we have dedicated support tools for our customers. So we suggest that you use GitHub tools for technical purposes only :)
Distributed under the MIT License.
AtInternet a Piano Company - support@atinternet.com
6.16.0
FAQs
JavaScript library for Piano Analytics
We found that piano-analytics-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.