Skip to content
A web analytics Javascipt client library using AWS kinesis stream designed to be used with Google Tag Manager (GTM).
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Web Page Analytic Client Library

A web analytics Javascipt client library using AWS kinesis stream designed to be used with Google Tag Manager (GTM).


Before you begin, Node.js and NPM must be installed on your system. For download instructions for your platform, see

Creating A Build

Get all required NPM modules. From the root of the repository, execute the following command on your terminal:

npm install

This downloads all dependencies.

Inside the config folder (create one if there's none), add a js file and name it "config.js". Paste the code below and provide the details of your AWS Kinesis account:

    var config = {
        accessKeyId: "",
        secretAccessKey: "",
        region: '',
        streamName: '',
        shards: 4,
        waitBetweenDescribeCallsInSeconds: 5

    module.exports = config;

Create the "build.js" file to be used with Google Tag Manager. Perform the command below from the root of the repo. This will bundle the files inside "lib" folder together with the config.js.


After the command finished, you should see a javascript file named "build.js". This is the file to be used for GTM.

Run Unit Test

From the root of the repo, perform the command below:

    npm test

Next open the Unit Test result here, http://localhost:8080/test/index.html

GTM Implementation Example

Create an account with Google Tag Manager.

Install GTM code on the page. Refer for installation here,

Create a "Custom HTML" with triggers on "All Elements" and "DOM Ready"

Paste the code below to GTM editor and publish.

 <script src=""></script>
 //build.js code should be pasted here
   !function(e){function t(n){if(r[n])return r[n].exports;var a= 
   ... more code 
 //end of build.js content

 //add some page load data  
   var referrer = {{Referrer}},
      page_url = {{Page URL}},
      page_path = {{Page Path}},
      page_host_name = {{Page Hostname}};
  dataLayer.push({'Referrer': referrer});
  dataLayer.push({'PageUrl': page_url});
  dataLayer.push({'PagePath': page_path});
  dataLayer.push({'PageHostName': page_host_name});
You can’t perform that action at this time.