Created
March 1, 2017 19:34
-
-
Save odewahn/630ae4d535ba35b4ab588fce931e59fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************************* | |
|| 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