Initialize a new Alias facade with a dictionary of arguments.

new Alias(dictionary: Object, opts: Object)

Extends Facade

Parameters
dictionary (Object) The object to wrap.
Name Description
dictionary.from string? The previous ID of the user.
dictionary.to string? The new ID of the user.
opts (Object) Options about what kind of Facade to create.
Instance Members
action()
type()
previousId()
from()
userId()
to()

Initialize a new Delete facade with a dictionary of arguments.

new Delete(dictionary: Object, opts: Object)

Extends Facade

Parameters
dictionary (Object) The object to wrap.
Name Description
dictionary.category string? The delete category.
dictionary.name string? The delete name.
dictionary.properties string? The delete properties.
opts (Object) Options about what kind of Facade to create.
Instance Members
type()

A Facade is an object meant for creating convience wrappers around objects. When developing integrations, you probably want to look at its subclasses, such as Track or Identify, rather than this general-purpose class.

This constructor will initialize a new Facade with an obj of arguments.

If the inputted obj doesn't have a timestamp property, one will be added with the value new Date(). Otherwise, the timestamp property will be converted to a Date using the new-date package.

By default, the inputted object will be defensively copied, and all ISO strings present in the string will be converted into Dates.

new Facade(obj: Object, opts: Object)
Parameters
obj (Object) The object to wrap.
opts (Object) Options about what kind of Facade to create.
Name Description
opts.clone boolean (default true) Whether to make defensive clones. If enabled, the inputted object will be cloned, and any objects derived from this facade will be cloned before being returned.
opts.traverse boolean (default true) Whether to perform ISODate-Traverse on the inputted object.
Static Members
proxy(field)
field(field)
multi(path)
one(path)
Instance Members
proxy(field)
field(field)
json()
options(integration)
context
enabled(integration)
active()
anonymousId()
sessionId()
groupId()
traits(aliases)
library()
device()
userAgent()
timezone()
timestamp()
channel()
ip()
userId()
state()
zip()
street()
country()
city()
region()

Initialize a new Group facade with a dictionary of arguments.

new Group(dictionary: Object, opts: Object)

Extends Facade

Parameters
dictionary (Object) The object to wrap.
Name Description
dictionary.userId string? The user to add to the group.
dictionary.groupId string? The ID of the group.
dictionary.traits Object? The traits of the group.
opts (Object) Options about what kind of Facade to create.
Instance Members
action()
type()
groupId
created()
email()
traits(aliases)
name()
industry()
employees()
properties()

Initialize a new Identify facade with a dictionary of arguments.

new Identify(dictionary: Object, opts: Object)

Extends Facade

Parameters
dictionary (Object) The object to wrap.
Name Description
dictionary.userId string? The ID of the user.
dictionary.anonymousId string? The anonymous ID of the user.
dictionary.traits string? The user's traits.
opts (Object) Options about what kind of Facade to create.
Instance Members
action()
type()
traits(aliases)
email()
created()
companyCreated()
companyName()
name()
firstName()
lastName()
uid()
description()
age()
avatar()
position()
username()
website()
websites()
phone()
phones()
address()
gender()
birthday()

Initialize a new Page facade with a dictionary of arguments.

new Page(dictionary: Object, opts: Object)

Extends Facade

Parameters
dictionary (Object) The object to wrap.
Name Description
dictionary.category string? The page category.
dictionary.name string? The page name.
dictionary.properties string? The page properties.
opts (Object) Options about what kind of Facade to create.
Instance Members
action()
type()
category
name
title
path
url
referrer()
properties(aliases)
email()
fullName()
event(name)
track(name)

Initialize a new Screen facade with a dictionary of arguments.

Note that this class extends Page, so its methods are available to instances of this class as well.

new Screen(dictionary: Object, opts: Object)

Extends Page

Parameters
dictionary (Object) The object to wrap.
Name Description
dictionary.category string? The page category.
dictionary.name string? The page name.
dictionary.properties string? The page properties.
opts (Object) Options about what kind of Facade to create.
Instance Members
action()
type()
event(name)
track(name)

Initialize a new Track facade with a dictionary of arguments.

new Track(dictionary: Object, opts: Object)

Extends Facade

Parameters
dictionary (Object) The object to wrap.
Name Description
dictionary.event string? The name of the event being tracked.
dictionary.userId string? The ID of the user being tracked.
dictionary.anonymousId string? The anonymous ID of the user.
dictionary.properties string? Properties of the track event.
opts (Object) Options about what kind of Facade to create.
Instance Members
action()
type()
event()
value()
category()
id()
productId()
promotionId()
cartId()
checkoutId()
paymentId()
couponId()
wishlistId()
reviewId()
orderId()
sku()
tax()
name()
price()
total()
repeat()
coupon()
shipping()
discount()
shippingMethod()
paymentMethod()
description()
plan()
subtotal()
products()
quantity()
currency()
referrer()
query()
properties(aliases)
username()
email()
revenue()
cents()
identify()