To log additional data, you need to decide what kind of data you want to capture and how that data will be stored.

Determining What Data to Log

You also need to decide what kind of data about the event you want to log. In a sense, you are defining the building blocks for your metric by determining which data points to capture. Those data points will be used to generate your metric. In order to track a data point, you need to add it to the appropriate item descriptor as a property and define a column for it in the relevant database table.

There are some data that are common to most metrics, while other data is only applicable for certain ones. Here’s a list of data that you should log:

Keep in mind that each column holding data that’s a number needing to be tallied in a report, such as revenueOrdered, should be identified as such in the metric handler component. The metric handler component includes the currencySumProperties, doubleSumProperties, and integerSumProperties properties to identify each property used for a metric of the specified type. See About MetricHandler for more information on these properties.

Where to Store Metric Data

Will you need a new item descriptor or can you add properties to an existing one? Do you need to create a new table or can you add columns to an existing table? It depends on the metric you are working with.

When adding new metrics for existing events, you should add new properties to the existing log item descriptor and add new columns to the existing log database for that table. For example, you may currently monitor user page visits, but would like to also know the state of residence for those users. You can create a new property for the pageVisitLogData item descriptor in ABTestLogRepository that defines state as a property, information for which is stored in a new state column in the abl_page_visit database table. The resultant report might calculate the number of page visits per user organized by state: 18 for Mississippi, 806 for Texas, and so on.

For new metrics added to events that aren’t currently used by ATG Campaign Optimizer tests, you should create a new log item descriptor and database table. A custom metric could track information about users who register for a site. Information such as profile ID, group ID, test ID, and time stamp could be logged in a database table called abl_registration with columns for holding profile, group, test, and time values. This database table, like all tables that store logging data for ATG Campaign Optimizer tests, must be accessible by the runtime and reporting modules and should define an index for the test_id column. The corresponding item descriptor, called RegistrationLogData, would define the four pieces of information as properties. In such cases, you would also need to create a dataset, data collection object, queue, and mapper for your metric. See Creating Recording Devices for instructions.

Ensuring Optimal Performance

Every item descriptor defined in ABTestLogRepository.xml should use the following attribute in order to avoid performance degradation in the ReportGeneratorService:

<attribute name="defaultUncachedItemQueries" value="true"/>