No analytics tool would be complete without giving you the opportunity to send custom goals yourself. In this guide, we will explore how this is possible with HockeyStack and how you can leverage this data in your dashboard.
Within your code
Whether you want to track form submissions or specific button clicks, the general syntax to send this data back to HockeyStack is:
HockeyStack.goal('Goal name' [, properties]);
Let's dissect this. The method takes in two arguments: a required String
variable representing the name of the custom goal, and an optional Object
variable consisting of any special property you want to send with your goal.
Here is an example goal you can send after the visitor added an item to their cart:
HockeyStack.goal('Added to cart', {
product: 'Rick Astley - Whenever You Need Somebody CD',
productId: 23318,
category: 'Music'
});
Keep in mind that this is also valid:
HockeyStack.goal('Added to cart');
In Your HockeyStack Dashboard
After you send your custom goals, you can analyze them in your HockeyStack dashboard just like any other action.
Without any other configuration, custom goals show up in the Users page:
In order to track them as actual goals, there is one more step. Go to Goals, and click + at the top right corner. In your definition, choose Custom Goals. HockeyStack will list all the custom goals that you send to it here. You can choose whichever you want and define it as a normal goal.
This is optional, but you can also filter your custom goals through their properties. Click + property and choose from the properties that HockeyStack detected automatically.
If you have any other questions or issues, you can always reach us through the live support or just sending an email to hello@hockeystack.com!