Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import KeenTracking from 'keen-tracking';
// Record all actions to a single event stream
const EVENT_STREAM_NAME = 'app-actions';
// Omit noisy actions if necessary
const OMITTED_ACTIONS = [
// '@@router/LOCATION_CHANGE'
];
// Define a client instance
const client = new KeenTracking({
projectId: 'YOUR_PROJECT_ID',
writeKey: 'YOUR_WRITE_KEY'
});
if (process.env.NODE_ENV !== 'production') {
// Optionally prevent recording in dev mode
Keen.enabled = false;
// Display events in the browser console
client.on('recordEvent', Keen.log);
}
// Track a 'pageview' event and initialize auto-tracking data model
client.initAutoTracking({
recordClicks: false,
recordFormSubmits: false,
recordPageViews: true
import KeenTracking from 'keen-tracking';
// Record all mutations to a single event stream
const EVENT_STREAM_NAME = 'app-mutations';
// Omit noisy mutations if necessary
const OMITTED_MUTATIONS = [
// 'KEYPRESS',
// 'WINDOW_RESIZED'
];
// Define a client instance
const client = new KeenTracking({
projectId: 'YOUR_PROJECT_ID',
writeKey: 'YOUR_WRITE_KEY'
});
// Optional debugging
KeenTracking.debug = true;
client.on('recordEvent', Keen.log);
// Track a 'pageview' event and initialize auto-tracking data model
client.initAutoTracking({
recordClicks: false,
recordFormSubmits: false,
recordPageViews: true
});
const vuexLogger = store => {
// Called when the store is initialized
import KeenTracking from 'keen-tracking';
// Record all actions to a single event stream
const EVENT_STREAM_NAME = 'app-actions';
// Omit noisy actions if necessary
const OMITTED_ACTIONS = [
// 'KEYPRESS',
// 'WINDOW_RESIZED'
];
// Define a client instance
const client = new KeenTracking({
projectId: 'PROJECT_ID',
writeKey: 'WRITE_KEY'
});
if (process.env.NODE_ENV !== 'production') {
// Optionally prevent recording in dev mode
Keen.enabled = false;
// Display events in the browser console
client.on('recordEvent', Keen.log);
}
// Track a 'pageview' event and initialize auto-tracking data model
client.initAutoTracking({
recordClicks: false,
recordFormSubmits: false,
recordPageViews: true
private initKeen() {
const { projectId, writeKey } = environment;
this.client = new Keen({
projectId,
writeKey
});
if (!environment.production) {
Keen.enabled = false;
Keen.debug = true;
this.client.on('recordEvent', (event, data) => {
console.log('event:', event);
console.log('data:', data);
});
}
const timer = Keen.utils.timer();
timer.start();
setupTracker = () => {
const keen = new KeenTracking({
projectId: process.env.KEENIO_PROJECTID,
writeKey: process.env.KEENIO_WRITEKEY,
});
const stagingCuckoo = {
infinario: (eventName: LogEvent, payload: EventPayload) => {
console.info('Event recorded to KeenIO', eventName, payload);
keen.recordEvent(eventName, payload);
},
};
window.cuckoo = stagingCuckoo;
};
init() {
if (this.config) {
if (this.config.public) {
this.publicClient = new KeenTracking(this.config.public);
this.publicClient.extendEvents(this.defaultPublicKeenPayload.bind(this));
}
if (this.config.private) {
this.privateClient = new KeenTracking(this.config.private);
this.privateClient.extendEvents(this.defaultPrivateKeenPayload.bind(this));
}
}
}
init() {
if (this.config) {
if (this.config.public) {
this.publicClient = new KeenTracking(this.config.public);
this.publicClient.extendEvents(this.defaultPublicKeenPayload.bind(this));
}
if (this.config.private) {
this.privateClient = new KeenTracking(this.config.private);
this.privateClient.extendEvents(this.defaultPrivateKeenPayload.bind(this));
}
}
}
constructor(props) {
const { keenAnalysis, keenTracking } = props;
client = keenAnalysis.instance || new KeenAnalysis(keenAnalysis.config);
if (keenTracking) {
keenTrackingClient = keenTracking.instance || new KeenTracking(keenTracking.config);
}
ReactDOM.render(
,
document.querySelector(props.container),
);
}
}
import _ from 'lodash';
import KeenTracking from 'keen-tracking'
const client = new KeenTracking({
projectId: gon.keen.projectId,
writeKey: gon.keen.writeKey
});
export default {
trackEvent(collectionName, action, data) {
const basicData = {
action: action,
device: gon.user.device,
page_category: gon.basic.pageCategory,
request_uuid: gon.user.requestUUID,
user_id: gon.user.userId
};
client.recordEvent(collectionName, _.merge(basicData, data));
}