NAME
WebService::Async::Segment::Customer - represents a customer object with methods to make Segment API calls.
DESCRIPTION
You can create objects directly or (preferably) indirectly using WebService::Async::Segment::new_customer. Segment calls "identify" and "track" can be triggered on objects of this class.
METHODS
new
Class constructor accepting a hash of named args containing customer info, along with a Segment API wrapper object (an object of class WebService::Async::Segment::Customer). There is no need to make this call if you create an object using WebService::Async::Segment::new_customer (as recommended).
The accepted params are:
api_client- Segment API wrapper object.user_idoruserId- Unique identifier of a user.anonymous_idoranonymousId- A pseudo-unique substitute for a User ID, for cases when you don't have an absolutely unique identifier.traits- Free-form dictionary of traits of the user, like email or name.
user_id
Unique identifier for the user in the database.
anonymous_id
A pseudo-unique substitute for a User ID, for cases when you don't have an absolutely unique identifier.
traits
Free-form dictionary of traits of the user, containg both standard and custom attributes. For more information on standard (reserved) traits please refer to https://segment.com/docs/spec/identify/#traits.
api_client
A WebService::Async::Segment object acting as Segment HTTP API client.
identify
Makes an identify call on the current customer. For a detailed information on the API call please refer to: https://segment.com/docs/spec/identify/.
It can be called with the following named params:
user_idoruserId- Unique identifier of a user (will overwrite object's attribute).anonymous_idoranonymousId- A pseudo-unique substitute for a User ID (will overwrite object's attribute).traits- Free-form dictionary of traits of the user, like email or name (will overwrite object's attribute).context- Context information of the API call. Note that the API wrapper automatically sets context sentAt and library fields.integrations- Dictionary of destinations to either enable or disable.timestamp- Timestamp when the message itself took place, defaulted to the current time by the Segment Tracking API. It is an ISO-8601 date stringcustom- Dictionary of custom business specific fileds.
About common fields please refer to: https://segment.com/docs/spec/common/.
It returns a Future object.
track
Makes a track call on the current customer. It can take any standard (event and properties), common or custom fields. For more information on track API please refer to https://segment.com/docs/spec/track/.
It can be called with the following parameters:
event- required. event name.properties- Free-form dictionary of event properties.context- Context information of the API call. Note that the API wrapper automatically sets context sentAt and library fields.integrations- Dictionary of destinations to either enable or disable.timestamp- Timestamp when the message itself took place, defaulted to the current time by the Segment Tracking API. It is an ISO-8601 date string.custom- Dictionary of custom business specific fileds.
About common API call params: https://segment.com/docs/spec/common/.
It returns a Future object.
AUTHOR
deriv.com DERIV@cpan.org
LICENSE
Copyright deriv.com 2019. Licensed under the same terms as Perl itself.