Module: BrazeAPI::Endpoints::Users::Track

Included in:
Client
Defined in:
lib/braze_api/endpoints/users/track.rb

Overview

Methods to call the users/track endpoint from a client instance

Constant Summary collapse

PATH =
'/users/track'

Instance Method Summary collapse

Instance Method Details

#track(args = {}) ⇒ Object

The main method calling the endpoint. Called with an object containing multiple events and/or purchases and attributes.



13
14
15
16
17
# File 'lib/braze_api/endpoints/users/track.rb', line 13

def track(args = {})
  args[:events] = add_time_and_app_id(args[:events]) if args[:events]
  args[:purchases] = add_time_and_app_id(args[:purchases]) if args[:purchases]
  post(PATH, params: args)
end

#track_attribute(attribute) ⇒ Object

If you would like to track a single attribute object



30
31
32
# File 'lib/braze_api/endpoints/users/track.rb', line 30

def track_attribute(attribute)
  track(attributes: [attribute])
end

#track_event(event) ⇒ Object

If you would like to track a single event object



20
21
22
# File 'lib/braze_api/endpoints/users/track.rb', line 20

def track_event(event)
  track(events: [event])
end

#track_purchase(purchase) ⇒ Object

If you would like to track a single purchase object



25
26
27
# File 'lib/braze_api/endpoints/users/track.rb', line 25

def track_purchase(purchase)
  track(purchases: [purchase])
end