SMART
Overview
What is SMART?
Q2 SMART is a targeting and messaging platform that will help FI marketers target messaging in online banking (including banner ads) based on user behavior, and easily manage multiple customized promotional campaigns.
What is a Trait?
A trait is a user-level data metric or model that represents a characteristic or behavior about an online banking user. It is stored in the form of a key and value.
What is an Audience?
An Audience is a logical collection of Traits. Audiences are created by our customers in order to identify interesting groups of users that they can target in SMART or Composable Dashboard today.
How do I interact with SMART?
The SDK maintains the q2-smart package in partnership with the Q2 SMART team. You can install the q2-smart package with the q2 upgrade command and selecting the q2-smart package.
This will install a package that acts as a wrapper to the internal SMART API.
Online form extensions also have a helper property that will allow for easy interaction. For example:
config = SmartTraitStoreConfig("smarttest-dev", "tps-reports")
self.smart_ts = config
audiences = await self.smart_ts.audience.get()
self.logger.debug(audiences.audience_list[0])
audience_id = audiences.audience_list[0].id
users = await self.smart_ts.audience.get_users(audience_id)
count = await self.smart_ts.audience.get_count(audience_id)
What are those values used for the configuration?
The SMART Trait Store Configs takes two values. These values are environment stack identifiers (also known as env stacks).
The first value is the source, and identifies the requester. This is used for a number of things like auditing and permissions.
The second value is the target. The target env stack can usually be found in the self.hq_credentials.env_stack variable.
Testing with SMART Trait Store
A mock service that simulates SMART Trait Store API is available for testing when developing in a sandbox without connecting to the real infrastructure.
Exercising the Endpoints
All v2 SMART endpoints are available at:
BASE_URL="https://dev.q2api.com/v2"
Refer to the SMART documentation under the Caliper API V2 section for all available SMART Trait Store endpoints.
Testing Traits with Mock Service
The following traits are available for testing:
Trait ID |
Type |
|---|---|
|
enum |
|
string |
|
float |
|
date |
|
bool |
The following traits are reserved for specific error testing:
Trait ID |
Type |
Simulated Error |
|---|---|---|
|
bool |
Permission error (403) |
|
date |
Permission error (403) |
|
string |
Permission error (403) |
|
bool |
Internal system error (500) |
Testing Audiences with Mock Service
The following audiences are available for testing:
Audience Name |
Audience ID |
Audience Type |
Audience Size |
|---|---|---|---|
|
|
Global |
50,000 |
|
|
Global |
25,000 |
|
|
Global |
25,001 |
|
|
FI Specific |
0 |
|
|
FI Specific |
5,000 |
Note
You do not need any additional configuration in order to use the mock service. If you need to point to a different mock service for any reason,
use the Q2SDK_SMART_URL environment variable as defined in the Configuration Settings
Developing SDK Extension
The SmartTraitStoreDemo SDK extension in our examples repo is a demo that exercises a subset of what the mock service supports (e.g. it does not cover all error scenarios or direct trait config lookup).
Deploying to a Caliper Sandbox:
Ensure
q2-smartis installed (q2 upgrade).Deploy the extension to a sandbox environment (
q2 install).The extension dashboard provides a UI with preset test scenarios for audiences and traits.
To configure your extension to talk to the real SMART Trait Store API in production, be sure to mention in your deployment ticket that the extension will require q2msg to be enabled and that your envstack should be fetched at deploy time.