Node library integration
For web applications, there is a library called page-actions-js that can be imported using a module bundler. This a method recommended for projects using, for example, React, Vue or Angular framework.
The source code of the library is available in page-actions-js Github repository.
Install library
Add page-actions-js library to your project:
npm install @pageactions/page-actions-js
Create client object
Then you can import and create a PageActions object to report actions from your web application.
const pageActions = new PageActions('yoursite.com')
.accountId('your-account-id')
This is just an example code. The code for your account can be found in the dashboard settings after you create an account.
Report actions
Report a page view when your page or view is displayed. The page view action should be the first action that is reported.
pageActions.pageView()
Report a custom action:
pageActions.action('button_click')
All the methods are documented here: https://github.com/pageactions/page-actions-js#how-to-use