A customer segment refers to a grouping of customers that meet specified criteria, and the collection of these criteria are known as segment conditions. Merchants can create segments in the SHOPLINE Admin to filter target customers. For example, merchants can save all customers who subscribe to marketing emails as a customer segment.

You can create a customer segment using the segmentCreate GraphQL API. This article primarily introduces the composition of customer segment conditions and how to create the query parameter in the segmentCreate API.

Composition of customer segment conditions

Customer segment conditions consist of one or more condition groups, connected by and, or, or not relationships. For example, as shown in the following figure, when the email subscription status is subscribed and the customer status is registered, these combined form a condition group.

Each condition group consists of individual conditions or nested condition groups, connected by and or or. For example, a simple condition might be that the email subscription status is subscribed.

image(1).png

Conditions

A condition is the fundamental element that composes a segment. As shown in the following table, the SHOPLINE Admin provides a variety of conditions for merchants to create segments.

image2.png

Condition groups

A condition group consists of one or more conditions or nested condition groups, collectively evaluating specified criteria. The groups circled as 1, 2, and 3 in the following figure are examples of condition groups.

image3.png

Combined condition groups

Combined condition groups include fixed conditions and relationships between those conditions. For example, in the following figure, the combined condition group Product purchased refers to customers who bought a specified product within a certain time period. This combined condition group consists of two conditions: Product purchased and Order date, connected by an and relationship.

The Combined condition group fields section lists all available combined condition groups. The structure of combined condition groups is predetermined and cannot be customized.

image11.png

Create customer segment conditions

You can create a customer segment using the segmentCreate Admin GraphQL API. Refer to the following data structures and field explanations to form the query parameter.

Conditions

Data structure

You can use the following JSON object to create a condition where the customer status is equal to registered.

{
"type": 0,
"metafield": false,
"mfType": null,
"key": "status",
"value": [
0
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
}

The condition created by the above JSON object corresponds to the following display effect in the SHOPLINE Admin.

en-image001.jpg

Field description

FieldTypeRequired or notDescription
typeNumberYesThe field must be set to the fixed value0, which indicates a condition.
metafieldBooleanNoIndicates whether the condition is a metafield condition.
+ true: The condition is a metafield condition.
+ false: The condition is not a metafield condition.
mfTypeEnumMFTypeNoThe type of the metafield.
Specify this field when you set metafield to true.
keyStringYesThe unique identifier for the condition. Refer to Condition fields for specific key values of different condition types.
valueArrayYesA list of specific values of the condition. Refer to Condition fields for specific field value values of different condition types.
operatorEnumOperatorYesThe operator of query conditions, used to define logical relationships in query conditions, such as equal to, not equal to, greater than, and less than.
Refer to Condition fields for specific operator values of different condition types.
extInfoExtInfoYesUsed to control the display of customer segment interactions on the SHOPLINE Admin page. See extInfo for more information.
Refer to Condition fields for specific extInfo values of different condition types.

extInfo
extInfo is a JSON string that enables the SHOPLINE Admin page to display different interactions based on various condition types.

For example, as shown in the following figures, Email subscription status and Last order date conditions show different interaction effects.

Email subscription status
{
"key": "emailSubscribeStatus",
"type": 0,
"operator": "IN",
"value": [
1,
2
],
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}"
}

image12.png

Last order date
{
"key": "lastOrderTime",
"type": 0,
"operator": "BETWEEN",
"value": [
1
],
"extInfo": "{\"componentType\":\"DATE\",\"dateType\":\"LAST_7_DAY\"}"
}

image5.png

EnumMFType
The following table shows valid values and descriptions of different metafield types.

ValueDescription
dateDate with a single value
date_timeDate and time with a single value
number_integerInteger with a single value
number_decimalDecimal with a single value
single_line_text_fieldSingle-line text with a single value
multi_line_text_fieldMulti-line text
colorColor with a single value
booleanBoolean type
list.dateDate with multiple values
list.date_timeDate and time with multiple values
list.number_integerInteger with multiple values
list.number_decimalDecimal with multiple values
list.single_line_text_fieldSingle-line text with multiple values
list.colorColor with multiple values

Condition groups

Data structure

You can use the following JSON object to create a condition group where the email domain is equal to @gmail.com and the language is equal to English.

{
"type": 1,
"blockType": 0,
"relation": "and",
"children": [
{
"type": 0,
"blockType": 0,
"key": "emailDomain",
"value": [
"@gmail.com"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"LIST_PAGE\",\"listSource\":\"emailDomain\",\"label\":[\"@gmail.com\"]}"
},
{
"type": 0,
"blockType": 0,
"key": "language",
"value": [
"en"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"LIST\",\"listSource\":\"language\",\"label\":[\"English\"]}"
}
]
}

The condition group created by the above JSON object corresponds to the following display effect in the SHOPLINE Admin.

en-image002.jpg

Field description

FieldTypeRequired or notDescription
typeNumberYesThe field must be set to the fixed value 1, which indicates a condition group.
blockTypeNumberYesThe type of the condition group. Valid values are:
+ 0: combined condition group
+ 1: non-combined condition group
keyStringNoThe unique identifier for the condition. Specify this field if you set the value of blockType to 1.
Refer to Combined condition group fields for specific key values.
relationStringYesThe logical relationship within the children list. Valid values are:
+ and: indicates a conjunctive relationship.
+ or: indicates a disjunctive relationship.
childrenArrayYesA list of conditions or condition groups.

Condition combination logic

The combinations of customer segment conditions follow two logics: conditions met and conditions unmet.

Conditions met

Conditions met consist of one or more condition groups, as shown in the following figure.

image6.png

Conditions met are represented by the conditions object in the query JSON data, as shown in the following code sample.

{
"conditions": {
"type": 1,
"relation": "and",
"blockType": 0,
"children": [
{
"type": 1,
"blockType": 0,
"relation": "and",
"children": [
{
"type": 0,
"blockType": 0,
"key": "emailDomain",
"value": [
"@gmail.com"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"LIST_PAGE\",\"listSource\":\"emailDomain\",\"label\":[\"@gmail.com\"]}",
},
{
"type": 0,
"blockType": 0,
"key": "language",
"value": [
"en"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"LIST\",\"listSource\":\"language\",\"label\":[\"English\"]}",
}
]
},
{
"type": 1,
"blockType": 0,
"relation": "and",
"children": [
{
"type": 0,
"blockType": 0,
"key": "userSource",
"value": [
"1",
"2"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
},
{
"type": 0,
"blockType": 0,
"key": "status",
"value": [
3
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
}
]
}
]
}
}

Conditions unmet

Conditions unmet consist of only one condition group, as shown in the following figure.

image7.png

Conditions unmet are represented by the not object in the query JSON data, as shown in the following code sample.

{
"not": {
"type": 1,
"relation": "and",
"blockType": 0,
"children": [
{
"type": 1,
"blockType": 0,
"relation": "and",
"children": [
{
"type": 0,
"blockType": 0,
"key": "status",
"value": [
0
],
"operator": "IN",
"relation": null,
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
},
{
"type": 0,
"blockType": 0,
"key": "ageLevel",
"value": [
4
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
}
]
}
]
}
}

Example

The following is a JSON object example of the query argument in the segmentCreate API.

Caution: Ensure you serialize the JSON object to a JSON string before passing it to the API.

{
"conditions": {
"type": 1,
"relation": "and",
"blockType": 0,
"children": [
{
"type": 1,
"blockType": 0,
"relation": "and",
"children": [
{
"type": 0,
"blockType": 0,
"key": "emailDomain",
"value": [
"@gmail.com"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"LIST_PAGE\",\"listSource\":\"emailDomain\",\"label\":[\"@gmail.com\"]}",
},
{
"type": 0,
"blockType": 0,
"key": "language",
"value": [
"en"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"LIST\",\"listSource\":\"language\",\"label\":[\"English\"]}",
}
]
},
{
"type": 1,
"blockType": 0,
"relation": "and",
"children": [
{
"type": 0,
"blockType": 0,
"key": "userSource",
"value": [
"1",
"2"
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
},
{
"type": 0,
"blockType": 0,
"key": "status",
"value": [
3
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
}
]
}
]
},
"not": {
"type": 1,
"relation": "and",
"blockType": 0,
"children": [
{
"type": 1,
"blockType": 0,
"relation": "and",
"children": [
{
"type": 0,
"blockType": 0,
"key": "status",
"value": [
0
],
"operator": "IN",
"relation": null,
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
},
{
"type": 0,
"blockType": 0,
"key": "ageLevel",
"value": [
4
],
"operator": "IN",
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}",
}
]
}
]
}
}

The conditions created by the above JSON object correspond to the following display effect in the SHOPLINE Admin.

en-image003.jpg

The following example shows a complete segmentCreate mutation containing the above conditions:

mutation {
segmentCreate(name: "Demo1", query: "{\"conditions\":{\"type\":1,\"relation\":\"and\",\"blockType\":0,\"children\":[{\"type\":1,\"blockType\":0,\"relation\":\"and\",\"children\":[{\"type\":0,\"blockType\":0,\"key\":\"emailDomain\",\"value\":[\"@gmail.com\"],\"operator\":\"IN\",\"extInfo\":\"{\\\"operatorType\\\":\\\"EQ\\\",\\\"componentType\\\":\\\"LIST_PAGE\\\",\\\"listSource\\\":\\\"emailDomain\\\",\\\"label\\\":[\\\"@gmail.com\\\"]}\"},{\"type\":0,\"blockType\":0,\"key\":\"language\",\"value\":[\"en\"],\"operator\":\"IN\",\"extInfo\":\"{\\\"operatorType\\\":\\\"EQ\\\",\\\"componentType\\\":\\\"LIST\\\",\\\"listSource\\\":\\\"language\\\",\\\"label\\\":[\\\"English\\\"]}\"}]},{\"type\":1,\"blockType\":0,\"relation\":\"and\",\"children\":[{\"type\":0,\"blockType\":0,\"key\":\"userSource\",\"value\":[\"1\",\"2\"],\"operator\":\"IN\",\"extInfo\":\"{\\\"operatorType\\\":\\\"EQ\\\",\\\"componentType\\\":\\\"ENUM\\\"}\"},{\"type\":0,\"blockType\":0,\"key\":\"status\",\"value\":[3],\"operator\":\"IN\",\"extInfo\":\"{\\\"operatorType\\\":\\\"EQ\\\",\\\"componentType\\\":\\\"ENUM\\\"}\"}]}]},\"not\":{\"type\":1,\"relation\":\"and\",\"blockType\":0,\"children\":[{\"type\":1,\"blockType\":0,\"relation\":\"and\",\"children\":[{\"type\":0,\"blockType\":0,\"key\":\"status\",\"value\":[0],\"operator\":\"IN\",\"relation\":null,\"extInfo\":\"{\\\"operatorType\\\":\\\"EQ\\\",\\\"componentType\\\":\\\"ENUM\\\"}\"},{\"type\":0,\"blockType\":0,\"key\":\"ageLevel\",\"value\":[4],\"operator\":\"IN\",\"extInfo\":\"{\\\"operatorType\\\":\\\"EQ\\\",\\\"componentType\\\":\\\"ENUM\\\"}\"}]}]}}") {
segment {
id
name
query
creationDate
lastEditDate
}
userErrors {
code
field
message
}
}
}

Field details

Condition fields

This section explains the condition fields value, operator, extInfo, and key based on different types of conditions, such as date, list, and integer.

Date

Pass in the preset date range or custom date range.

value
To customize a date range, pass a list of timestamps, for example, [1701705600000, 1702051199999].

For preset data ranges, refer to the following table for valid values and pass in an enumeration value, such as [1].

Preset valueDescription
0Today
1Past 7 days
2Past 30 days
3Past 90 days
4Past 12 months

operator
Valid values are as follows:

  • BETWEEN: indicates a custom date range.
  • EQ: indicates a preset date range.

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value DATE.
dateTypeValid values are:
+ CUSTOME: The custom date range.
+ TODAY: The date range is set to today.
+ LAST_7_DAY: The date range is set to the last seven days.
+ LAST_30_DAY: The date range is set to the last thirty days.
+ LAST_90_DAY: The date range is set to the last ninety days.
+ LAST_12_MONTH: The date range is set to the last twelve months.

key
The following key values indicate different time condition types.

key valuesNameDescription
createTimeCustomer's join dateDate of store's first customer information acquisition
singleOrderAmountTimeOrder dateUsed together with singleOrderAmount in Combined condition group to list the date of the order
firstOrderTimeFirst order dateDate of customer's first successful order
lastOrderTimeLast order dateDate of customer's last successful order
lastAbandonedCreateTimeLast cart abandonment dateDate of customer's last cart abandonment
lastLoginTimeLast login dateDate of customer's last login to online store
loginChannelTimeLogin dateUsed together with loginChannel in Combined condition group to list the date of login
lastCartCreateTimeLast add-to-cart dateDate of customer's last add-to-cart action
purchasedItemTimeOrder dateUsed together with purchasedItem in Combined condition group to list the date of the order
purchasedCateTimeOrder dateUsed together with purchasedCate in Combined condition group to list the date of the order
Example
{
"key": "lastLoginTime",
"type": 0,
"operator": "EQ",
"value": [
2
],
"extInfo": "{\"componentType\":\"DATE\",\"dateType\":\"LAST_30_DAY\"}"
}

Integer

Pass in a range of integers.

value
When the value of operator is BETWEEN, pass in a pair of integers, such as [2, 10].

For other operator values, pass in a single integer, such as [10].

operator
ValueDescription
EQEqual to
NENot equal to
GTGreater than
LTLess than
BETWEENWithin the interval

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value NUMBER.

key
The following key values indicate different integer condition types.

key valueNameDescription
payOrderCntOrder quantityAccumulated successful orders
loginCountVisited timesCustomer's visited times to online store in last 90 days
Example
{
"key": "loginCount",
"type": 0,
"operator": "EQ",
"value": [
2
],
"extInfo": "{\"componentType\":\"NUMBER\"}"
}

Decimal

Pass in a range of decimals.

value
When the value of operator is BETWEEN, pass in a pair of decimals, such as [2.3, 10.9].

For other operator values, pass in a single decimal, such as [2.3].

operator
ValueDescription
EQEqual to
NENot equal to
GTGreater than
LTLess than
BETWEENWithin the interval

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value FLOAT.

key
Only the metafield condition supports the decimal data type. Refer to Metafield for how to specify key values.

Example
{
"key": "my_fields.float",
"type": 0,
"operator": "EQ",
"value": [
1.33
],
"metafield": true,
"mfType": "list.number_decimal",
"extInfo": "{\"componentType\":\"FLOAT\",\"mfName\":\"Decimal\"}"
}

Amount

Pass in a range of amounts in cents. For example, $20 corresponds to 2000 cents.

value
When the value of operator is BETWEEN, pass in a pair of amount values, such as [2000, 10000].

For other operator values, pass in a single amount value or a list of amount values, such as [10000].

operator
ValueDescription
EQEqual to
NENot equal to
GTGreater than
LTLess than
BETWEENWithin the interval

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value PRICE.

key
The following key values indicate different amount condition types.

key valueNameDescription
totalAmountConsumption amountAccumulated consumption amount
singleOrderAmountSingle consumption amountSuccessful order amount history
unitPriceAverage order valueCustomer's average consumption amount of each order
preferPricePrice preferencePreferential product prices figured out through customer's purchase history
preferDiscountDiscount sensitivityPreferential discount amount of each order figured out through customer's purchase history
Example
{
"key": "totalAmount",
"type": 0,
"operator": "EQ",
"value": [
20000
],
"extInfo": "{\"componentType\":\"PRICE\"}"
}

Boolean

Pass in a boolean.

value
Valid values are true and false.

  • true: indicates an affirmative or positive condition, essentially indicating yes.
  • false: indicates a negative or opposite condition, essentially indicating no.
operator
ValueDescription
EQEqual to
NENot equal to

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value BOOLEAN.

key
Only the metafield condition supports the boolean data type. Refer to Metafield for how to specify key values.

Example
{
"key": "my_fields.vip",
"type": 0,
"operator": "EQ",
"value": false,
"metafield": true,
"mfType": "boolean",
"extInfo": "{\"componentType\":\"BOOLEAN\",\"mfName\":\"Important customer\"}"
}

Address

Pass in an address object.

value
Provide the address information specified in the Key column of the following table.

KeyTypeRequired or notDescription
countryStringYesThe country or region.
countryCodeStringYesThe two-letter country or region code that follows the ISO 3166-1 (alpha 2) standard. For example, US.
provinceStringYesThe province.
provinceCodeStringYesThe code that represents the province.
cityStringYesThe city.
cityCodeStringYesThe code that represents the city.
districtStringYesThe district.
districtCodeStringYesThe code that represents the district.
operator
ValueDescription
EQEqual to
NENot equal to

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value ADDRESS.

key
The following key values indicate the address condition.

key valueNameDescription
addressAddressCustomer's country, province, city
Example
{
"key": "address",
"type": 0,
"operator": "EQ",
"value": {
"countryCode": "US",
"country": "United States",
"provinceCode": "4200001",
"province": "Alabama",
"cityCode": "",
"city": "",
"districtCode": "",
"district": ""
},
"extInfo": "{\"componentType\":\"ADDRESS\"}"
}

Tag

SHOPLINE predefines a set of recommended tags that allow for quick filtering to identify specific customer groups.

operator
The field must be set to the fixed value EQ.

value
The field must be set to the fixed value 1.

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value TAG.
subGroupThe tag subgroup. Refer to the table under key for valid values.

key
The following key values indicate different tag condition types.

key valueNameDescriptionsubGroup
isLoginNotPayVisited without placing an orderCustomers who visited online store while not placing ordersattractNew
isAddCartNotPayIn30Add products into cart without placing orders in the last 30 daysCustomers who subscribed emails and added into cart while not placing orders in the last 30 daysattractNew
isAbandonedIn30Abandoned order last 30 daysCustomers who subscribed emails and abandoned shopping cartattractNew
isNotOrderIn30Subscribed emails without placing orders last 30 daysCustomers who subscribed emails and not placing orders in the last 30 daysattractNew
isFirstOrderFirst order subscribersCustomers who subscribed emails and purchased for only onceoldRepurch
isRecentHighConsumeHigh consumption recent daysCustomers with higher consumption amount in last 90 daysoldRepurch
isRecentHighOrderMany orders placed recent daysCustomers with more orders placed last 90 daysoldRepurch
isRecentConsumedPurchased recent daysCustomers with consumption history in last 90 dayslossRecovery
isOnceActivedCustomers with active historyCustomers with higher consumption history while not placing orders in recent 12 monthslossRecovery
isRecentAbandonedAbandoned order recent daysCustomers who abandoned cart in the last 30 dayslossRecovery
isHighValueHigh-value customersCustomers with high value from RFM calculationkeyPperations
isBirthdayInNextMonthBirthday in next monthCustomers with birthday next monthkeyPperations
isRecentActivedActive in recent daysCustomers with login history in the last 30 dayskeyPperations
isRepurchasedReturned customersCustomers with life cycle as returned customerkeyPperations
Example
{
"key": "isNotOrderIn30",
"type": 0,
"operator": "EQ",
"value": 1,
"extInfo": "{\"subGroup\":\"attractNew\",\"componentType\":\"TAG\",}"
}

Enumeration list

Pass in a list of data sets for the enumeration type. For example, the valid values for customer Status are Black list, Not invited, Invited, and Registered.

key
The following key values indicate different condition types for the enumeration list.

key valueNameDescription
userSourceCustomer's join channelSource of store's first customer acquisition
platformPlatform where customers joinThe platform sales channel where the store obtains customers for the first time
statusCustomer statusCustomer status
emailSubscribeStatusEmail subscription statusCustomer's email subscription status
genderGenderCustomer's gender
ageLevelAgeCustomer's age
birthdayMonthBirth monthCustomer's birth month
smsSubscribeStatusSMS subscription statusCustomer's SMS subscription status
preferActivityActivity type preferencePreferential activity types figured out through customer's purchase history
rfmRFM valueCustomer value figured out through comprehensive consideration of customer's consumption amount, times and recent consumption time
customerCycleCustomer life cycleCustomers distributed by life cycle, as potential customers, first-time customer, returned customer, lost customer

value
The following table lists enumerated values corresponding to various key types. For example, you can pass in [1, 2].

userSource
ValueDescription
1Import from admin
2Online store registration
3Offline store
4Store relocation
5POS registration
6Sign in with Multipass
7Storefront
8Manually created
16Social media
17API creation
18Website subscription
19Unlogged user order
20Google
23TikTok
24Shop App
25Marketplace
26Apple
platform
ValueDescription
1shopify
2bigcommerce
3woocommerce
4lightspeed
5shoplazaza
6etsy
7zalora
8kogan
9amazon
10ebay
status
valueDescription
0Black list
1Not invited
2Invited
3Registered
emailSubscribeStatus
ValueDescription
0Unsubscribed
1Subscribed
2Not subscribed
3Awaiting confirmation
5Not set
gender
ValueDescription
0Unknown
1Male
2Female
3Undisclosed
ageLevel
ValueDescription
00 - 20
121 - 30
231 - 40
341 - 50
451 - 60
561 - 70
671 - 100
birthdayMonth
ValueDescription
1January
2February
3March
4April
5May
6June
7July
8August
9September
10October
11November
12December
smsSubscribeStatus
ValueDescription
0Unsubscribed
1Subscribed
2Not subscribed
preferActivity
ValueDescription
0Discount activity
1Flash sales
2Tie-in sales
4Combo pack
5Giveaway
6Pre-sale
rfm
ValueDescription
0High-value customers
1Potential high-value customers
2Loyal customers
3Potential loyal customers
4Big spenders
5Potential big spender
6At-risk customers
7Almost lost customers
customerCycle
ValueDescription
0Potential customers
1First-time customers
2Returned customers
3Lost customers
operator
valueDescription
INInclude
NOT_INExclude

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyValue
componentTypeThe field must be set to the fixed value ENUM.
operatorTypeThe field must be set to the fixed value EQ.
Example
{
"key": "status",
"type": 0,
"operator": "IN",
"value": [
3,
0
],
"extInfo": "{\"operatorType\":\"EQ\",\"componentType\":\"ENUM\"}"
}

Asnychronous data list

Pass in a list of dynamic data values. For example, the available values for Products purchased will vary depending on the merchant's product data.

value
The data source value collection. For example, if the data source is a product, then pass in the collection of product IDs, such as ['productId111', 'productId222'].

extInfo
This field is a JSON string that contains key-value pairs, refer to the following table for valid values.

KeyTypeValue
componentTypeStringThis affects the way to query the data source. Valid values are:
+ LIST: indicates that the API is called to get and display all available options at once.
+ LIST_PAGE: indicates that the API is called for paginated retrieval and display of available options.
Pass in a fixed value based on the corresponding key-value relationships outlined in the key table.
operatorTypeStringThis affects the display texts for the page operators. Valid values are:
+ EQ: displays page texts Equals to and Not equals to.
+ IN: displays page texts Include and Exclude.
For example, if you pass in EQ, the texts Equals to and Not equals to will be displayed, as shown in the following figure.
image10.png
Pass in a fixed value based on the corresponding key-value relationships outlined in the key table.
listSourceStringThe data source. Pass in a fixed value based on the corresponding key-value relationships outlined in the key table.
labelArray[String]The display texts. For example, if you pass in a collection of product IDs for value, then label should be a collection of product names.

key
The following key values indicate different condition types for the asynchronous data list, and corresponding values for componentType, operatortype, and listSource.

key valueNameDescriptioncomponentTypeoperatorTypelistSource
languageCustomer languageCustomer's online store languageLISTEQlanguage
lastLoginChannelLast visit channelSource of customer's last visit to online storeLISTEQloginChannel
loginChannelChannels visitedSources of customer's visit to online store in last 90 daysLISTEQloginChannel
purchasedCateProduct category purchasedPurchased products of specific categoryLISTINcategoryList
preferCateProduct category preferencePreferential product categories figured out through customer's purchase historyLISTINcategoryList
emailDomainEmail domainCustomer's email domainLIST_PAGEEQemailDomain
purchasedItemProducts purchasedPurchased specific productsLIST_PAGEINproductList
preferItemTagProduct tag preferencePreferential product tags figured out through customer's purchase historyLIST_PAGEINproductLabelList
customerTagCustomer tagTags added for customers manually in customer listLIST_PAGEINcustomerLabelList
operator
valueDescription
INInclude
NOT_INExclude
Example
{
"key": "purchasedCate",
"type": 0,
"operator": "IN",
"value": [
"12257647834446320149372682",
"12257647834482223391662682"
],
"extInfo": "{\"operatorType\":\"IN\",\"componentType\":\"LIST\",\"listSource\":\"categoryList\",\"label\":[\"fashion shirt\",\"summer vacation\"]}"
}

Metafield

All metafields under the customer module can be conditions. For more information about metafields, refer to Guide to using metafields feature.

key
In the format: {metafield.namespace}.{metafield.key}. For example, my_fields.date.

value/operator/extInfo
Pass in value, operator, and extInfo according to the corresponding condition types. The mapping relationship between metafield types and condition types is as follows:

Metafield typeCondition typeDescription
dateDate-
date_time
list.date
list.date_time
booleanBoolean-
single_line_text_fieldAsynchronous data listThe value of extInfo.componentType must be set to LIST_PAGE_FRONT.
list.single_line_text_field
multi_line_text_field
color
list.color
number_decimalDecimal-
list.number_decimal
number_integerInteger-
list.number_integer

extInfo
In addition to the parameters required by various condition types, you must also specify the following parameter.

KeyTypeRequired or notDescription
mfNamestringYesThe name of the metafield.
Example
{
"key": "my_fields.date",
"type": 0,
"operator": "EQ",
"value": [
3
],
"metafield": true,
"mfType": "list.date",
"extInfo": "{\"componentType\":\"DATE\",\"mfName\":\"Date\",\"dateType\":\"LAST_90_DAY\"}"
}

Combined condition group fields

relation

The field must be set to the fixed value and, which indicates that the relationship between conditions in a combined condition group is "and".

key

The following conditions are combined condition groups:

key valueNameIncluded basic conditions
singleOrderAmountSingle consumption amount+ singleOrderAmount
+ singleOrderAmountTime
loginChannelChannels visited+ loginChannel
+ loginChannelTime
purchasedItemProducts purchased+ purchasedItem
+ purchasedItemTime
purchasedCateProduct category purchased+ purchasedCate
+ purchasedCateTime

Example

The following example shows a JSON object used for creating a combined condition group Product purchased.

{
"key": "purchasedItem",
"type": 1,
"relation": "and",
"blockType": 1,
"children": [
{
"key": "purchasedItem",
"type": 0,
"operator": "IN",
"value": [
"16054924754902568180002744"
],
"extInfo": "{\"operatorType\":\"IN\",\"componentType\":\"LIST_PAGE\",\"listSource\":\"productList\",\"label\":[\"Halloween Pumpkin Print T-shirt\"]}"
},
{
"key": "purchasedItemTime",
"type": 0,
"operator": "EQ",
"value": [
2
],
"extInfo": "{\"componentType\":\"DATE\",\"dateType\":\"LAST_30_DAY\"}"
}
],
}

The combined condition group created by the above JSON object corresponds to the following display effect in the SHOPLINE Admin.

image9.png

Was this article helpful to you?

Error loading component.

Error loading component.