- Support Home
- Knowledge Base
- Subscriber Management
- Subscriber Profiles
- Calculated Custom Field Use Cases
Calculated Custom Field Use Cases
"Calculated Custom Fields (CCF)" in Taguchi provide powerful ways to segment and personalize your marketing campaigns based on specific criteria or subscriber behaviors. Below are various use cases that can be implemented. These examples showcase the versatility and utility of CCFs in different scenarios.
Why Use Calculated Custom Fields
- Dynamic Data Segmentation: Automatically categorize subscribers based on behavior, attributes, or interactions.
- Real-time Data Calculation: CCFs are computed at runtime, ensuring up-to-date information.
- Customizable Business Logic: Define custom rules for field calculations using a scripting language or editor.
- Enhanced Targeting and Personalization: Create highly targeted campaigns based on real-time data.
Benefits of Calculated Custom Fields:
- Automation: Update and maintain field values automatically.
- Precision: Enables specific targeting based on real-time data.
- Flexibility: Adaptable to diverse business needs.
- Efficiency: Automates complex data processing tasks.
Refer to this link to find out How to create a custom field
Examples of Calculated Custom Fields:
1. Tag Active Subscribers with a True value
- Use case: Tag subscribers who have made a purchase in the last 3 months.
- Target Expression:
Purchased in the last 3 months
- Rule:
FUN main() RETURN "True" END
2. Round Robin Allocation Across 4 Groups
- Use case: Distribute customers evenly across four groups (G1, G2, G3, G4).
- Target Expression:
ID is not null
- Rule:
FUN main() VAR group = LOAD("group", 0) IF group == 4 THEN VAR newGroup = SAVE("group", 1) ELSE VAR newGroup = SAVE("group", group + 1) END RETURN "G" + STR(newGroup) END
3. 30/30/30/10% Group Split
- Use case: Segment customers into four groups (G1, G2, G3, G4) with a 30/30/30/10% distribution.
- Rule:
FUN main() VAR split = LOAD("split", 1) SAVE("split", split + 1) IF split == 10 THEN SAVE("split", 1) RETURN "G4" ELIF split >= 7 THEN RETURN "G3" ELIF split >= 4 THEN RETURN "G2" ELSE RETURN "G1" END END
4. Percentage-Based Group Allocation
- Use case: Segment customers with one group containing 5%, and splitting the remaining three (G1 - 32%, G2 - 32%, G3 - 31%, G4 - 5%).
- Rule:
FUN main() VAR split = LOAD("split", 1) SAVE("split", split + 1) IF split > 20 THEN SAVE("split", 1) RETURN "G4" ELIF split > 13 THEN RETURN "G3" ELIF split > 6 THEN RETURN "G2" ELSE RETURN "G1" END END
5. A/B Testing Group Assignment
- Use case: Assign the first 50,000 subscribers to a test group and the remaining to a control group for A/B testing.
- Rule:
FUN main() VAR group_num = LOAD("group", 0) + 1 VAR saved_group_num = SAVE("group", group_num) IF saved_group_num <= 50000 THEN RETURN 1 ELSE RETURN 2 END END
6. Record Subscriber Opt-In Date
- Use case: Capture the exact datetime when a subscriber opts in.
- Rule:
FUN main() RETURN CURRENT_DATETIME() END
- For date in YYYY-MM-DD format: Replace
CURRENT_DATETIME()
withCURRENT_DATE()
.
- For date in YYYY-MM-DD format: Replace
7. Segment by States
- Use case: Tag subscribers as "North Australia" or "South Australia" based on their state.
- Rule:
FUN main() VAR state = $["state"] IF state == "Queensland" OR state == "Northern Territory" OR state == "Western Australia" THEN RETURN "North Australia" ELSE IF state == "Victoria" OR state == "New South Wales" OR state == "Australian Capital Territory" OR state == "Tasmania" THEN RETURN "South Australia" ELSE RETURN "Other Region" END END
8. Return Values A, B, or C Based on "Status"
- Use case: Return "A" or "B" based on the value of the "Status" custom field.
- Target Expression:
Status ilike "%"
- Rule:
FUN main() VAR status = LOWERCASE($["Status"]) IF status == "yes" THEN RETURN "A" ELIF status == "no" THEN RETURN "B" ELSE RETURN "C" END END
9-1 Assign Subscribers to Random Groups for Segmentation
- Use case: Randomly assign 150,000 subscribers to different groups.
Custom field one:
- Target Expression:
(subscribed lists 31 and contactable via email) random 150000
- Rule:
FUN main() VAR group = LOAD("group", 0) IF group == 1 THEN VAR newGroup = SAVE("group", 1) ELSE VAR newGroup = SAVE("group", group + 1) END RETURN "G" + STR(newGroup) END
9-2 Assign all Remaining subscribers
Custom field two:
- Target Expression:
(subscribed lists 31 and contactable via email and not 'cf:custom field one' ilike "%")
- Rule:
FUN main() RETURN "G4" END
10. Convert DOB to Age
- Use case: Convert a childβs DOB to age (e.g., "2020-07-07" to "3 years").
- Target Expression:
cf:Child1_DOB ilike "%"
- Rule:
FUN main() VAR AGE_VALUE = AGE(GET_DATETIME_FROM_ISO8601_STRING($["Child_DOB_value"])) RETURN YEARS(AGE_VALUE) END
Additional Use Cases:
Functions for Rule Logic:
MAKE_E164_FORMAT(country_code, phone_value)
: Formats a phone number into E164 format using a specified country code (e.g., AU, SG). Requires a country code and phone number field.MAKE_E164_FORMAT(country_code, phone_number_field)
GET_DATETIME_FROM_STRING(value, format)
: Converts a string to a datetime object using the specified format (compatible with Python's strftime/strptime).GET_DATETIME_FROM_STRING(value, format)
GET_DATETIME_FROM_ISO8601_STRING(value)
: Converts an ISO8601 string to a datetime object.GET_DATETIME_FROM_ISO8601_STRING(value)
AGE(value)
: Calculates age from a datetime value relative to the current date.AGE(GET_DATETIME_FROM_ISO8601_STRING("value"))
YEARS(value)
: Returns the number of years from a datetime interval.YEARS(datetime_value)
MONTHS(value)
: Returns the number of months from a datetime interval.MONTHS(datetime_value)
DAYS(value)
: Returns the number of days from a datetime interval.DAYS(AGE(GET_DATETIME_FROM_ISO8601_STRING("value")))
These examples offer a foundation for using Calculated Custom Fields in various marketing scenarios. Adapt these rules as needed to fit your requirements.
For additional questions or further assistance with Custom Fields, please contact Taguchi Support.