Track an Event

You can track activities performed by your users using our track method call.

ParameterOptionalDescription
activity_name
String
NoThe activity that you are tracking against a user. We recommend using _ (underscore) notation for names. Eg: purchased, subscribed_to_plan, canceled_plan.
activity_properties
Hash/Object
YesProperties that you'd like to associate with the activity. You can use these properties in your triggered emails, as well as search users based on the activities they performed. Eg: {"product_name": "Mountain Dew", "price": "10.10", expires: "2015-04-29T13:00:28+00:00"}
callbackYesA callback function that will be called when the call to track is complete. A boolean indicating success/failure will be passed as a parameter to this callback.

Using the track method with no properties.

nudgespot.track("canceled_plan"); //Track event without any properties

Using the track method with properties.

// Track event with properties
nudgespot.track("add_to_cart", {"items": [{"value": 200, "name": "Hugo Boss Perfume"}],"total_value": 200});