The W20 Extras addon provides various functionality such as website analytics.
bower install w20-extras
To include the addon, declare it in the application manifest:
If you are using the
w20-bridge addon, be sure to include the w20-extras module:
<dependency> <groupId>org.seedstack.addons.w20</groupId> <artifactId>w20-bridge-web-extras</artifactId> </dependency>
Analytical tools allow statistical reporting and data analysis for your web applications:
- Counting and tracking visitor’s actions
- Statistics on page viewed
- Keyword searched
- E-commerce specific report
- Setting cookies for tracking visit
- Displaying comprehensive and detailed reports
Analytics providers generally requires a script inclusion in all web pages to track user actions based on the URL. However, in SPA, since the routing is done at the front end, this integration is a bit more tricky. W20 uses Angulartics internally to provide an easy integration of a wide range of providers.
Include the extra fragment configuration in your fragment manifest and enable its analytics module. To configure you analytics provide, use the following properties:
- provider (string): The name of the analytic provider to use. Supported providers are given below:
||Google Analytics for Cordova|
||Google Tag Manager|
||Mix Panel analytics|
virtualPageViews (boolean): By default automatic virtual page view tracking is enabled, meaning the entire user navigation across the different routes of your application is tracked. You can turn it off with this property.
settings (object): If the chosen provider has a supported default configuration in W20, you can use this property to configure it.
After deploying your Piwik server, you are provided with a site id for your registered website. Set it to the
siteId property and paste the URL to the
jsUrl property and your Piwik PHP server address into the
Your website visits should be monitored by Piwik. The
enableLinkTracking options of Piwik are already applied.
An angular service
PiwikService can now be injected to configure Piwik. This service provide the following methods:
getAPI(): return the Piwik object
configure(settings): Called initially to configure the provider with the
settingsproperty configured in the manifest. It can be called programatically to change these settings later.