Class: OursprivacyIngest::Resources::Visitor

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Visitor

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 Visitor.

Parameters:



53
54
55
# File 'lib/oursprivacy_ingest/resources/visitor.rb', line 53

def initialize(client:)
  @client = client
end

Instance Method Details

#upsert(token:, user_properties:, default_properties: nil, email: nil, external_id: nil, identity_context: nil, user_id: nil, request_options: {}) ⇒ OursprivacyIngest::Models::VisitorUpsertResponse

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

Define visitor properties on an existing visitor or create a new visitor. This fires a $identify event, making the call visible in the event stream. 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 docs.oursprivacy.com/docs/data-types for details and common pitfalls.

Parameters:

Returns:

See Also:



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/oursprivacy_ingest/resources/visitor.rb', line 38

def upsert(params)
  parsed, options = OursprivacyIngest::VisitorUpsertParams.dump_request(params)
  path = @client.base_url_overridden? ? "identify" : "https://api.oursprivacy.com/api/v1/identify"
  @client.request(
    method: :post,
    path: path,
    body: parsed,
    model: OursprivacyIngest::Models::VisitorUpsertResponse,
    options: options
  )
end