Download mothership-analytics.lib.js and place it in your javascript directory (the example below we assume it's called "js").
Place the following code in your <head>:
<script>
window.MothershipConfig = {
apiKey: "XXXXXX"
};
</script>
<script src="/js/mothership-analytics.lib.js"></script>API
window.MothershipAnalytics.newEvent(experienceKey, eventKey, pointValue = 1, force = false);Example:
window.MothershipAnalytics.newEvent("experienceKey", "eventKey", 10);Keep in mind that an experienceKey/eventKey combination will only fire one time per page load unless you pass the force flag. This is to prevent components that you may include multiple times on a page from skewing your results. However, if you do want to force a fire (like in a SPA application where the page only really loads one time) you can pass a fourth argument to make that happen.
window.MothershipAnalytics.newEvent("experienceKey", "eventKey", 10); // Will report
window.MothershipAnalytics.newEvent("experienceKey", "eventKey", 10); // Will not report because it's a duplicate of the first one
window.MothershipAnalytics.newEvent("experienceKey", "eventKey", 10, true); // Will report even though it's a duplicateyarn buildnpm run buildyarn servenpm run serveyarn testnpm run test