# Attributes List

Below is a list of all the meta-language objects, along with the supported triggers and operators, that you can use when configuring your campaigns in Open Loyalty.&#x20;

They are organized into sections based on the relevant trigger objects.

## Member

{% hint style="warning" %}
In the referral campaigns, `customer` context refers to the referee.\
If you want to aim the referrer, use `refferer` context, e.g.\
`referrer.labels`, `referrer.lastTransactionDate`
{% endhint %}

### Personal Details

<table><thead><tr><th width="308">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>customer.firstName</strong></td><td>Member's first name</td></tr><tr><td><strong>customer.lastName</strong></td><td>Member's last name</td></tr><tr><td><strong>customer.gender</strong></td><td>Member's gender</td></tr><tr><td><strong>customer.email</strong></td><td>Member's email</td></tr><tr><td><strong>customer.phone</strong></td><td>Member's phone number</td></tr><tr><td><strong>customer.loyaltyCardNumber</strong></td><td>Member's loyalty card number</td></tr></tbody></table>

### Address Details

<table><thead><tr><th width="310">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>customer.address.street</strong></td><td>Street name</td></tr><tr><td><strong>customer.address.address1</strong></td><td>Building name</td></tr><tr><td><strong>customer.address.address2</strong></td><td>Flat / Unit name</td></tr><tr><td><strong>customer.address.city</strong></td><td>City</td></tr><tr><td><strong>customer.address.postal</strong></td><td>Postal code</td></tr><tr><td><strong>customer.address.province</strong></td><td>State / Province</td></tr><tr><td><strong>customer.address.country</strong></td><td>Country</td></tr></tbody></table>

### Profile Details

<table><thead><tr><th width="312">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>customer.level</strong></td><td>Member's current tier</td></tr><tr><td><strong>customer.levelAchievementDate</strong></td><td>Date when member upgraded (or downgraded) to the current tier</td></tr><tr><td><strong>customer.labels</strong></td><td>Member's custom attribute</td></tr><tr><td><strong>customer.registeredDate</strong></td><td>Member's registration date<br><br><span data-gb-custom-inline data-tag="emoji" data-code="2757">❗</span>This value is separate from the member's creation date (if specified in the member's profile).</td></tr><tr><td><strong>customer.legalConsent</strong></td><td>Legal Consent (true/false)<br><br><span data-gb-custom-inline data-tag="emoji" data-code="2757">❗</span>Also referred to as the <strong>Basic Legal Agreement</strong> in the member profile or as <strong>agreement1</strong> in the API.</td></tr><tr><td><strong>customer.marketingConsent</strong></td><td>Marketing Consent (true/false)<br><br><span data-gb-custom-inline data-tag="emoji" data-code="2757">❗</span>Also referred to as the <strong>Marketing Agreement</strong> in the member profile or as <strong>agreement2</strong> in the API.</td></tr><tr><td><strong>customer.dataProcessingConsent</strong></td><td>Data Processing Consent (true/false)<br><br><span data-gb-custom-inline data-tag="emoji" data-code="2757">❗</span>Also referred to as the <strong>Data Processing Agreement</strong> in the member profile or as <strong>agreement3</strong> in the API.</td></tr></tbody></table>

### Transaction Details

All the details are based on the transactions registered and matched with the member.

<table><thead><tr><th width="313">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>customer.firstTransactionDate</strong></td><td>Date of the member's first transaction</td></tr><tr><td><strong>customer.lastTransactionDate</strong></td><td>Most recent date of the member's last transaction</td></tr><tr><td><strong>customer.numberOfPurchases</strong></td><td>Total count of member's transactions</td></tr><tr><td><strong>customer.averagePurchaseAmount</strong></td><td>Average transaction value (based on all transactions)</td></tr></tbody></table>

### Units Details

{% hint style="warning" %}
Remember to replace the code with a valid wallet code.
{% endhint %}

<table><thead><tr><th width="421">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><p></p><p><strong>customer.getWallet("<code>code</code>").activeUnits</strong></p><p></p></td><td>Number of active units</td></tr><tr><td><strong>customer.getWallet("<code>code</code>").spentUnits</strong></td><td>Number of spent units</td></tr><tr><td><strong>customer.getWallet("<code>code</code>").earnedUnits</strong></td><td>Number of total earned units</td></tr><tr><td><strong>customer.getWallet("<code>code</code>").lockedUnits</strong></td><td>Number of pending units</td></tr><tr><td><strong>customer.getWallet("<code>code</code>").blockedUnits</strong></td><td>Number of blocked units</td></tr><tr><td><strong>customer.getWallet("<code>code</code>").expiredUnits</strong></td><td>Number of expired units</td></tr></tbody></table>

## Transaction

### Main Details

<table><thead><tr><th width="343">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>transaction.documentNumber</strong></td><td>Document number</td></tr><tr><td><strong>transaction.purchasedAt</strong></td><td>Document date</td></tr><tr><td><strong>transaction.purchasePlace</strong></td><td>Purchase place</td></tr><tr><td><strong>transaction.labels</strong></td><td><strong>Transaction's</strong> custom attributes</td></tr><tr><td><strong>transaction.qty</strong></td><td>Total quanity of items in a transaction</td></tr><tr><td><strong>transaction.grossValue</strong></td><td>Transaction's gross value</td></tr><tr><td><strong>transaction.channelId</strong></td><td>Channel ID</td></tr></tbody></table>

### Item Details

<table><thead><tr><th width="387">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>transaction.category(‘shoes’).qty</strong></td><td>Total number of items in a specified category</td></tr><tr><td><strong>transaction.category(‘shoes’).grossValue</strong></td><td>Total gross value of items in a specified category</td></tr><tr><td><strong>transaction.maker(‘Nike’).qty</strong></td><td>Total number of items of a specified brand</td></tr><tr><td><strong>transaction.maker(‘Nike’).grossValue</strong></td><td>Total gross value of items of a specified brand</td></tr><tr><td><strong>transaction.sku(‘SKU123’).qty</strong></td><td>Total number of items with a specified SKU</td></tr><tr><td><strong>transaction.sku(‘SKU123’).grossValue</strong></td><td>Total gross value of items with a specified SKU</td></tr><tr><td><strong>transaction.itemLabel(‘SKU123’).qty</strong></td><td>Total number of items with a specified custom attribute key</td></tr><tr><td><strong>transaction.itemLabel(‘SKU123’).grossValue</strong></td><td>Total gross value of items with a specified custom attribute key</td></tr><tr><td><strong>transaction.itemLabel(‘SKU123’, ‘Value’).qty</strong></td><td>Total number of items with a specified custom attribute key and value</td></tr><tr><td><strong>transaction.itemLabel(‘SKU123’, ‘Value’).grossValue</strong></td><td>Total gross value of items with a specified custom attribute key and value</td></tr><tr><td><strong>transaction.itemLabels</strong></td><td>Transaction items' custom attributes </td></tr></tbody></table>

### Transaction Item Filters

<table><thead><tr><th width="343">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>agg(filter(transaction.items,’<code>scenario_1</code>’)).sumBy(‘grossValue’)</strong></td><td>Returns the <strong>total gross value</strong> of all items in the transaction that match <strong><code>scenario_1</code></strong>.</td></tr><tr><td><strong>agg(filter(transaction.items,'<code>scenario_1</code>')).sumBy('qty')</strong></td><td>Returns the <strong>total quantity</strong> of items in the transaction that match <strong><code>scenario_1</code></strong>.</td></tr><tr><td><strong>agg(filter(transaction.items,’<code>scenario_1</code>’)).sumBy(‘grossValue’, 100)</strong></td><td>Returns the <strong>total gross value</strong> of all items in the transaction that match <strong><code>scenario_1</code></strong>, with each transaction item line capped at 100.</td></tr><tr><td><strong>agg(filter(transaction.items,'<code>scenario_1</code>')).sumBy('qty', 1)</strong></td><td>Returns the <strong>total quantity</strong> of items in the transaction that match <strong><code>scenario_1</code></strong>, with each transaction item line capped at 1.</td></tr></tbody></table>

## Custom Event

<table><thead><tr><th width="343">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>event.eventDate</strong></td><td>Date of a custom event</td></tr><tr><td><strong>event.eventId</strong></td><td>Event ID of a custom event<br><br><span data-gb-custom-inline data-tag="emoji" data-code="2757">❗</span>This field represents the external ID, if one has been added. It should not be confused with the <code>customEventId</code> that is automatically generated in Open Loyalty.</td></tr><tr><td><strong>event.body.sampleatributename</strong></td><td>Attribute system identifier</td></tr></tbody></table>

{% hint style="info" %}
The term `sampleatributename` refers to the identifier assigned to an attribute in the custom event schema. For instance, if you added an attribute with the identifier `colour`, you would access this attribute as `event.body.colour`.&#x20;

For further details, please refer to the article:

[custom-event-schemas](https://help.openloyalty.io/main-features/custom-events/custom-event-schemas "mention")
{% endhint %}

## Internal Event

Any internal event that triggers the campaign.

### Achievement Progress

<table><thead><tr><th width="274">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>event.body.progressStatuses[0].currentPeriodValue</strong></td><td>Current value of the progress within the selected rule.</td></tr><tr><td><strong>event.body.progressStatuses[0].periodGoal</strong> </td><td>Goal value within the selected rule.</td></tr><tr><td><strong>event.body.progressStatuses[0].consecutivePeriods</strong></td><td>Number of consecutive periods within the selected rule.</td></tr><tr><td><strong>event.body.progressStatuses[0].completedConsecutivePeriods</strong> </td><td>Completed consecutive periods within the selected rule.</td></tr><tr><td><strong>event.body.progressChanges[0]</strong></td><td>Progress change (returned as number) within the selected rule.</td></tr><tr><td><strong>event.body.completedCount</strong></td><td>Completed count of the achievement.</td></tr></tbody></table>

{% hint style="info" %}
The objects of expressions are available only in the Achievement progressed option in the Internal Event Campaign.

event.body.progressStatuses\[0] - The number \[0] in the object refers to the first rule in the achievement.&#x20;
{% endhint %}

### Current Time

<table><thead><tr><th width="291">Context Object</th><th>Description</th></tr></thead><tbody><tr><td><strong>executionContext.processedAt</strong></td><td>Datetime of the triggered process</td></tr></tbody></table>
