Class: OursprivacyIngest::Resources::Track

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

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.



66
67
68
# File 'lib/oursprivacy_ingest/resources/track.rb', line 66

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. Include userId, externalId, email, or userProperties.phone_number to associate the event with an existing visitor. Identity resolution runs in priority order: userId (direct, no lookup) → externalId → email → userProperties.phone_number. Each lookup runs only if earlier identifiers did not resolve a visitor. Phone matching ignores common formatting and an international + or 00 prefix, but does not infer a country code. If you know both userId and externalId, send both. For top-level visitor properties: null clears the existing value, while undefined, omitted fields, and empty strings are ignored. For entries inside custom_properties: null, undefined, and empty strings are all ignored (custom_properties use merge semantics). See https://docs.oursprivacy.com/docs/data-types for details and common pitfalls.



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oursprivacy_ingest/resources/track.rb', line 51

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