Skip to main content
All CollectionsTriggers
Data for use in trigger scripts
Data for use in trigger scripts

Access data for use in custom scripts.

Updated over 9 months ago

Data objects

Object name

Description

person.actions

Array of actions taken by the system for this visitor, for example, emails sent.

person.events

Array of events for this visitor.

person.devices

Array of devices used by this visitor.

person.extend

Object containing the extend data for this visitor.

person.email

Email address.

person.n

Full name.

person.fn

First name.

person.ln

Last name.

task

Object containing the task information.

analytics

Object containing the analytics information for this visitor.


Next-level objects

The top-level objects contain the following attributes:

Devices

Object name

Description

dt

Date

ua

Array of user agents.

Tasks

Object name

Description

dt

Date

cart

Cart

signal

The signal that caused this trigger.

Signal

Object name

Description

type

Signal type code.

dt

Date

o_num

Order number.

Purchase complete signals only.

Cart

Object name

Description

dt

Date

cp

Cart Price

p

Array of products.

Products within cart.p

The variables below assume you use product as your loop variable name.

Each product has the following attributes:

Merge code

Description

product.img

Image URL.

product.img_tn

Image thumbnail URL.

Not always available.

product.n

Name

product.desc

Description

Only some types of cart provide this.

product.prid

Product ID.

product.qty

Quantity in the cart.

product.u

URL of the product page.

product.up

Unit price.

product.rup

Regular unit price.

If available.

product.sku

Product SKU.

If available.

product.opt

Dictionary of customer-specific choices for this product , for example, product.opt.colour.

If available.

product.ex

Dictionary of product-specific extra data for this product, for example, product.ex.manufacturer.

If available.

product.stock

Stock level.

If available.

product.curr

ISO 4217 currency code, for example, GBP, USD

If available.

product.lang

Language.

If available.

product.sbr

Site brand: optionally used to separate products from different site brands or storefronts.

If available.

Analytics

Example name

Description

lapsed_customer_30

Previous customer that has not bought in the last 30 days.

top_customer_7

Top customer, measured over last 7 days.

analytics.device_mobile_7

Mobile device used, measured over last 7 days, for example, Android or iOS.

analytics.device_tablet_7

Tablet device used, measured over last 7 days, for example, Android or iOS.

analytics.device_pc_7

PC device used, measured over last 7 days, for example, Windows XP.


Advanced - Helper functions available to the Javascript

The following helper functions can be used by the JavaScript as an alternative to accessing the data directly:

Function

Description

getCart()

helpers.getCart()

Returns the cart, or an empty object if none.

Guaranteed to always return some kind of object, which makes client scripts simpler and safer

getProducts()

helpers.getProducts()

Returns the array of products in the current cart, or an empty array if none.

Guaranteed to always return some kind of array, which makes client scripts simpler and safer.

checkCartStock()

helpers.checkCartStock()

Checks the stock level of products in the cart.

If there is one product that has a stock greater than 0, it returns true. If all products are out of stock it returns false.

If stock is not set for a product, this is treated as out of stock.

sentInRecentMinutes(signalTypes,numMinutes)

helpers.sentInRecentMinutes(['b'],100)

Returns number of emails sent of the specified signal types in the past number of minutes specified.

Parameters are:

  • Array of signal types:

    • 'b' = cart abandonment

    • 'ba' = browse abandonment

    • 't' = purchase complete

    • 'cu' = custom signal

    • Number of minutes (numMinutes)

signalsInRecentMinutes(signalTypes, numMinutes)

helpers.signalsInRecentMinutes(['b'], 100)

Returns number of signals of the specified types in the past number of minutes specified.

Parameters are:

  • Array of signal types

  • Number of minutes (numMinutes)

getSignalsInRecentMinutes(signalTypes, numMinutes)

helpers.getSignalsInRecentMinutes(['b'], 100)

Returns all of the person's signals of the specified types that are from the last number of minutes specified.

Parameters are:

  • Array of signal types

  • Number of minutes (numMinutes)

getProductsFromSignalsInRecentMinutes(signalTypes, numMinutes)

helpers.getProductsFromSignalsInRecentMinutes(['b'], 120)

Returns all the products from the signals with the specified types that have been raised in the last number of minutes specified.

For example, with a signal type of ['pd'] and numMinutes of 120 this function returns an array of all the products that the person has browsed in the last 2 hours.

Parameters are:

  • Array of signal types

  • Number of minutes (numMinutes)

If you’re interested in more advanced usage beyond the scope of this guide, contact your Account Manager or contact Support for Professional Services assistance.

Did this answer your question?