Skip to content

coveo/coveo.analytics.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Pierre-Alexandre St-Jean
May 10, 2016
206170d · May 10, 2016

History

64 Commits
Apr 26, 2016
May 10, 2016
May 5, 2016
Apr 20, 2016
Apr 26, 2016
Apr 21, 2016
Apr 19, 2016
May 3, 2016
Apr 19, 2016
May 5, 2016
May 10, 2016
May 10, 2016
Apr 26, 2016
Apr 26, 2016
Apr 19, 2016
May 5, 2016
Apr 26, 2016

Repository files navigation

coveo.analytics

Build Status dependency status dev dependency status Coverage Status

Coveo's Usage Analytics' javascript client

Web Analytics Usage

<script>
(function(c,o,v,e,O,u,a){
a='coveoua';c[a]=c[a]||function(){(c[a].q=c[a].q|| []).push(arguments)};
c[a].t=Date.now();u=o.createElement(v);u.async=1;u.src=e;
O=o.getElementsByTagName(v)[0];O.parentNode.insertBefore(u,O)
})(window,document,'script','https://static.cloud.coveo.com/coveo.analytics.js/coveoua.js')

// Replace YOUR-TOKEN with your real token
// (eg: an API key which has the rights to write into Coveo UsageAnalytics)
coveoua('init','YOUR-TOKEN');
coveoua('send','pageview');
</script>

To Add additional informations or give hints to Coveo's Reveal engine.

// ...
coveoua('init','YOUR-TOKEN');
coveoua('send','pageview',{
  contentIDKey: options.contentIDKey,
  contentIDValue: options.contentIDValue,
  contentType: options.contentType
  // ... more information ...
});

Usage (for developers)

You have to provide your own fetch API compatible libraries in the global environment.

npm install coveo.analytics isomorphic-fetch

Then use in TypeScript or javascript

import fetch from 'isomorphic-fetch'; // isomorphic-fetch modifies global environment
import coveoanalytics from 'coveo.analytics';

// Create an api client
const client = new coveoanalytics.analytics.Client({ token : 'YOUR-TOKEN'})
// Send your event
client.sendCustomEvent({
  eventType: "dog";
  eventValue: "Hello! Yes! This is Dog!";
});

Contributing

git clone
npm install
./node_modules/.bin/typings install
npm run build:tsc
npm run build:webpack
# code code code
# open pull request

License

MIT license. See LICENSE.

forthebadge coveo