Skip to content

Instantly share code, notes, and snippets.

@odewahn
Created March 1, 2017 19:34
Show Gist options
  • Save odewahn/630ae4d535ba35b4ab588fce931e59fe to your computer and use it in GitHub Desktop.
Save odewahn/630ae4d535ba35b4ab588fce931e59fe to your computer and use it in GitHub Desktop.
/*********************************************************************
|| Import required modules
*********************************************************************/
import {fromJS} from 'immutable'
import Keen from 'keen-js'
var client = new Keen({
projectId: "your-project-id",
writeKey: "your-write-key"
})
/*********************************************************************
|| The reducer. Not really doing much here, but you can add update
|| code to make changes here
*********************************************************************/
export default function(state = fromJS({}), action) {
return state
}
/*********************************************************************
|| Action functions. To use, do this...
|| import {keenButtonClicked} from './your/path/to/reducer.js'
||
|| dispatch(keenButtonClicked("signup"))
*********************************************************************/
export function keenButtonClicked(buttonName) {
return (dispatch, getState) => {
client.addEvent("button-clicked", {
buttonName: buttonName
})
}
}
export function keenAPIKeyValidation(status) {
return (dispatch, getState) => {
client.addEvent("api-key-validation", {
status: status
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment