- A configurable Chi Square algorithm - A configurable version of standard Chi Square algorithm where minimum conversions per variant can be configured. Chi Square is a algorithm often used in statistical calculations to determine whether there is a significant difference between different variants in a test.
- Reach Conversion Goal algorithm - A simple algorithm that just make the variant that first a a specific number of conversions to the winner. Can be useful in demos etc.
Create your own analytics provider
- Extend the class: com.sdl.experienceoptimization.analytics.AnalyticsManagerBase
- Implement 3 methods:
- trackView() - track a view of an experiment variant
- trackConversion() - track a conversion of an experiment variant (normally a click on the experiment banner)
- getAnalyticsResults() - get tracking data to be presented in the XO experiment dashboard
public class LocalAnalyticsManager extends AnalyticsManagerBase {
// Worker thread to asynchronously store tracking data
private static AnalyticsResultWorker resultWorker;
// DB repository for tracking data
private static AnalyticsResultRepository resultRepository;
@Override
public void trackView(ExperimentDimensions experimentDimensions,
Map<String, String> metadata) {
// Submit view tracking data to the worker thread
//
this.resultWorker.submitTracking(new TrackedExperiment(experimentDimensions,
ExperimentType.VIEW));
}
@Override
public void trackConversion(ExperimentDimensions experimentDimensions,
Map<String, String> metadata) {
// Submit conversion tracking data to the worker thread
//
this.resultWorker.submitTracking(new TrackedExperiment(experimentDimensions,
ExperimentType.CONVERSION));
}
@Override
protected AnalyticsResults getStatisticsResults(Date startDate,
Date endDate,
StatisticsExperimentDimensions experimentDimensions,
StatisticsTimeDimensions timeDimensions,
List<String> extraDimensions,
StatisticsFilters statisticsFilters,
int startIndex,
int maxResults) throws Exception {
List<AggregatedTracking> trackings = this.resultRepository.getTrackingResults(statisticsFilters);
SimpleAnalyticsResults results = new SimpleAnalyticsResults();
if ( trackings != null ) {
for (AggregatedTracking tracking : trackings) {
this.addAnalyticsResultsRow(results, tracking, experimentDimensions, timeDimensions);
}
}
return results;
}
}
The full source code for the local database provider is found here:
<Analytics implementationClass="[Analytics provider class name]" timeoutMilliseconds="5000" trackingRedirectUrl="/redirect/">
[Properties to the analytics provider ...]
ExperimentWinnerAlgorithmClassName>[Experiment winner class name]</ExperimentWinnerAlgorithmClassName>
[Properties to the algorithm...]
</Analytics>
Local Database Analytics Provider
- Download the precompiled package: https://github.com/NiclasCedermalm/xo-extensions/blob/master/xo-analytics-provider-localdb/compiled/local-analytics-provider.zip
- Unzip in it under ‘services’ in your XO query and management micro services
- Configure conf/smarttarget_conf.xml:
<Analytics
implementationClass="com.sdl.experienceoptimization.analytics.localdb.LocalAnalyticsManager"
timeoutMilliseconds="5000" trackingRedirectUrl="/redirect/“>
<!— Storage —>
<Storage url=“[JDBC URL]" className=“[JDBC Driver classname]" cacheTime="10000”/>
<!— How often the worker thread stores the results in the database —>
<TrackingStoreInterval>10000</TrackingStoreInterval>
<!— Winner algorithm -->
<ExperimentWinnerAlgorithmClassName>
com.sdl.experienceoptimization.analytics.algorithm.ReachConversionGoalAlgorithm
</ExperimentWinnerAlgorithmClassName>
<ConversionGoal>10</ConversionGoal>
<!— Chi Square algorithm
<ExperimentWinnerAlgorithmClassName>
com.sdl.experienceoptimization.analytics.algorithm.ConfigurableChiSquareAlgorithm
</ExperimentWinnerAlgorithmClassName>
<MinimumConversionsPerVariant>100</MinimumConversionsPerVariant>
—>
</Analytics>
- Restart your XO micro services and then you are all set!
<Analytics implementationClass="com.sdl.experienceoptimization.analytics.localdb.LocalAnalyticsManager"
timeoutMilliseconds="5000" trackingRedirectUrl="/redirect/“>
...
<Dummy experimentId=“[EXPERIMENT ID, e.g. a9cf5654-c6ab-41ec-a8da-3b13de130c0c]">
<MinViews>[MAX VIEWS, e.g. 230]</MinViews>
<MaxViews>[MIN VIEWS, e.g. 300]</MaxViews>
<MinConversions>[MIN CONVERSIONS, e.g. 0]</MinConversions>
<MaxConversions>[MAX CONVERSIONS, e.g. 70]</MaxConversions>
<Winner>
<Publication>[PUBLICATION ID, e.g. tcm:0-3-1]</Publication>
<VariantIndex>[WINNER VARIANT ID, e.g. 1]</VariantIndex>
<MinConversions>[WINNER MIN CONVERSIONS, e.g. 50]</MinConversions>
<MaxConversions>[WINNER MAX CONVERSIONS; e.g. 100]</MaxConversions>
</Winner>
</Dummy>
</Analytics>