Class: OursprivacyIngest::Resources::Track

Inherits:
Object
  • Object
show all
Defined in:
lib/oursprivacy_ingest/resources/track.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Track

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Track.

Parameters:



58
59
60
# File 'lib/oursprivacy_ingest/resources/track.rb', line 58

def initialize(client:)
  @client = client
end

Instance Method Details

#event(token:, event:, default_properties: nil, distinct_id: nil, email: nil, event_properties: nil, external_id: nil, identity_context: nil, time: nil, user_id: nil, user_properties: nil, request_options: {}) ⇒ OursprivacyIngest::Models::TrackEventResponse

Some parameter documentations has been truncated, see Models::TrackEventParams for more details.

Track events from your server. Please include at least one of: userId, externalId, or email. These properties help us associate events with existing users. For all fields, null values unset the property and undefined values do not unset existing properties.

Parameters:

  • token (String)

    The token for your Source. You can find this in the dashboard.

  • event (String)

    The name of the event you’re tracking. This must be whitelisted in the Ours dash

  • default_properties (OursprivacyIngest::Models::TrackEventParams::DefaultProperties, nil)

    These properties are used throughout the Ours app to pass known values onto dest

  • distinct_id (String, nil)

    A unique identifier for the event. This helps prevent duplicate events.

  • email (String, nil)

    The email address of a user. We will associate this event with the user or creat

  • event_properties (Hash{Symbol=>String, nil}, nil)

    Any additional event properties you want to pass along.

  • external_id (String, nil)

    The externalId (the ID in your system) of a user. We will associate this event w

  • identity_context (OursprivacyIngest::Models::TrackEventParams::IdentityContext, nil)

    End-user network context for server-side calls. Required for probabilistic ident

  • time (Float, nil)

    The time at which the event occurred in milliseconds since UTC epoch. The time m

  • user_id (String, nil)

    The Ours user id stored in local storage and cookies on your web properties. If

  • user_properties (OursprivacyIngest::Models::TrackEventParams::UserProperties, nil)

    Properties to set on the visitor. (optional) You can also update these propertie

  • request_options (OursprivacyIngest::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/oursprivacy_ingest/resources/track.rb', line 43

def event(params)
  parsed, options = OursprivacyIngest::TrackEventParams.dump_request(params)
  path = @client.base_url_overridden? ? "track" : "https://api.oursprivacy.com/api/v1/track"
  @client.request(
    method: :post,
    path: path,
    body: parsed,
    model: OursprivacyIngest::Models::TrackEventResponse,
    options: options
  )
end