- Support Home
- Knowledge Base
- Subscriber Management
- Subscriber Profiles
- How to Use Calculated Custom Field Templates
How to Use Calculated Custom Field Templates
Taguchi offers 3 preset templates for generating Calculated Custom Field (CCF) rules, providing an easy alternative to manual rule setup. These templates simplify assigning values to subscribers based on specific criteria or distribution methods. The advanced Javascript rule type is also available for custom calculations and event-based fields.
For more Calculated Custom Field examples, see Calculated Custom Field Use Cases.
Steps to choose a rule type
- In your Calculated Custom Field setup, go to Rule Type.
- Select one of the three presets, or select Javascript for a custom rule:
- Values Determined By Target Expression
- Round Robin Split
- Percentage Split
- Javascript
- Configure the parameters as required (e.g., target expressions, values, percentages).
- Save your CCF to apply the template.

1. Values Determined By Target Expression
This preset rule allows you to associate a custom field value with one or more target expressions. The rule will run the set of target expressions against all subscribers who match the overall target expression for the field, and assign the corresponding value to each subscriber.
For example, you could have an overall target expression of purchased, and then assign a value of 1 to the expression purchased count=1, 2 to purchased count=2, 3 to purchased count=3 etc. You'd then have a custom field which contains the number of times a customer has purchased.
The value from the first target expression (after the overall target expression has been matched) will always take priority.

2. Round Robin Split
For example, if your values are 1st and 2nd, the first subscriber will be assigned to the value 1st and the second to the value 2nd. This can be used to create evenly matched test groups of equal size.


3. Percentage Split
This is similar to the above, but allows you to assign a percentage chance of a subscriber having each of the values.
For example, if you assign 1st with 50%, 2nd with 25%, and 3rd with 25%, after sufficient subscribers have been evaluated;
- 50% of them will have the value 1st
- 25% will have the value 2nd
- 25% will have the value 3rd


Because these values are assigned randomly, you'll need 1000+ subscribers for the percentages to be roughly consistent with your settings used in the fields.
Please note that the percentage values in the right column must add up to 100
4. Javascript rule type
The Javascript rule type is not a preset template. It provides an editor for writing custom JavaScript when the preset templates do not cover the required calculation.
Use it to:
- Calculate values from standard and custom subscriber fields.
- Process matching purchases, tracked events or activity interactions.
- Maintain rolling event histories or counters as new events arrive.
- Derive preferences such as purchase day-part, most frequented venue or last purchased venue.
A JavaScript CCF must define main(subscriber) and return the value to store. Event-based fields can also use the global event object when the target expression uses a supported relative event condition such as purchased 1 hour ago.
function main(subscriber) {
if (typeof event === "undefined" || !event) return null;
let eventData = {};
try {
eventData = typeof event.data === "string"
? JSON.parse(event.data)
: (event.data || {});
} catch (error) {
return null;
}
return eventData?.uri?.LocationNo ?? null;
}
For configuration details, see Managing Custom Fields in Taguchi. For event-based examples, see JavaScript event-based CCF use cases.
Backfill tip: The wide-window catch-up method is suitable only for last-event fields. It cannot backfill rolling histories or calculations that aggregate multiple events; contact Taguchi Support when backend historical processing is required.