tree: 177e07e00c42819620d0317b0ef7bb16095bb009 [path history] [tgz]
  1. README.md
  2. javascript/
  3. karaf-kar/
  4. pom.xml
  5. wab/
extensions/web-tracker/README.md

Apache Unomi Web Tracker

This extension is providing the web tracker to start collecting visitors data on your website. The tracker is implemented as an integration of analytics.js for Unomi.

Getting started

Extension can be tested at : http://localhost:8181/tracker/index.html

In your page include unomiOptions and include code snippet from snippet.min.js :

<script type="text/javascript">
        var unomiOption = {
            scope: 'realEstateManager',
            url: 'http://localhost:8181'
        };
        window.unomiTracker||(window.unomiTracker={}),function(){function e(e){for(unomiTracker.initialize({"Apache Unomi":unomiOption});n.length>0;){var r=n.shift(),t=r.shift();unomiTracker[t]&&unomiTracker[t].apply(unomiTracker,r)}}for(var n=[],r=["trackSubmit","trackClick","trackLink","trackForm","initialize","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","personalize"],t=0;t<r.length;t++){var i=r[t];window.unomiTracker[i]=function(e){return function(){var r=Array.prototype.slice.call(arguments);return r.unshift(e),n.push(r),window.unomiTracker}}(i)}unomiTracker.load=function(){var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=unomiOption.url+"/tracker/unomi-tracker.min.js",n.addEventListener?n.addEventListener("load",function(n){"function"==typeof e&&e(n)},!1):n.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||e(window.event)};var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(n,r)},document.addEventListener("DOMContentLoaded",unomiTracker.load),unomiTracker.page()}();
</script>

window.unomiTracker can be used to send additional events when needed.

Check analytics.js API here. All methods can be used on unomiTracker object, although not all event types are supported by Unomi intergation.

How to contribute

The source code is in the folder javascript with a package.json, the file to update is analytics.js-integration-apache-unomi.js apply your modification in this file then use the command yarn build to compile a new JS file.
Then you can use the test page to try your changes http://localhost:8181/tracker/index.html.