Walkthrough: Using the interactions pipeline to aggregate and store reporting data
This topic demonstrates how to create a classic interaction aggregation processor that groups total number of visits and total value of all visits against the user agent of the interaction.
We recommend that you upgrade your classic interaction processors to batch interaction processors to improve performance.
You will create:
-
A dimension table, which is a reference table that stores a list of unique user agents with IDs.
-
A fact table, which stores user agent IDs against total visit and value generated by that user agent.
-
Fact and dimension classes, which model the data in the fact and dimension table.
-
An interaction aggregation processor, which uses the fact and dimension classes to populate the tables in the reporting database.
Create dimension class and table
Create dimension class and table
The dimension table stores a list of user agent strings. Each user agent has a unique ID. The dimension table is referenced by the fact table, which stores the total number of visits and total value of all visits against a user agent ID.
Creating a dimension class
Every dimension has a key and a value class that is specific to that dimension - in this case, they are UserAgentNameKey (example key: -1743424285) and UserAgentNameValue (example value: Chrome).
-
Create a dimension key class:
-
Create a dimension value class:
-
Create a dimension class that uses the
UserAgentNameKeyandUserAgentNameValueclasses:
Creating a dimension table
A dimension table should have the same name as the class. For example, the UserAgentName class should have a matching dbo.UserAgentName table with columns matching the class properties.
-
In the reporting database, create the following table:
Create fact class and table
Create fact class and table
The dimension table stores a list of user agent IDs against the total number of visits and total value of visits generated by that user agent.
Creating a fact class
-
Create a fact value class:
NoteThe
Reduce()method must be implemented so that two fact values can be added together. -
Create fact key class:
-
Create a fact class that uses the
UserAgentFactKeyandUserAgentValueclasses:
Creating a fact table
A fact table should have the same name as the class, prefixed with Fact_. For example, the UserAgentFact fact class would have a matching dbo.Fact_UserAgentFact table with columns matching the class properties.
-
In the reporting database, create the following table:
Create an interaction aggregation processor class
Create an interaction aggregation processor class
Create an class that inherits InteractionAggregationPipelineProcessor. The following example uses the fact and dimension classes created in previous steps. The processor will automatically populate the fact and dimension tables.
You can access facets and services such as the xConnect Client API in the context of an interaction aggregation processor.
Add processor to configuration
Add processor to configuration
Patch the processor into configuration as shown: