Advanced Adobe Analytics events data configuration
This guide explains how to create an enrichment script to load events data into Adobe Analytics.
Introduction
To load Adobe Analytics events data into the Adobe Analytics destination, the events data must be in a specific format.
To conform to this format, use an enrichment script that collects the Adobe Analytics events data into a single column, events, and adds it to the data extract. Multiple columns containing different Adobe Analytics events data need to be joined into a single column, where each of the column values are separated by a comma.
For example, if a data extract contained the following rows:
eventA |
eventB |
eventC |
---|---|---|
Row_01_a |
Row_01_b |
Row_01_c |
Row_02_a |
Row_02_b |
Row_02_b |
Row_03_a |
Row_03_b |
Row_03_c |
Then the new column, events, containing the concatenated Adobe Analytics events data is as follows:
events |
---|
eventA=Row_01_a,eventB=Row_01_b,eventC=Row_01_c |
eventA=Row_02_a,eventB=Row_02_b,eventC=Row_02_c |
eventA=Row_03_a,eventB=Row_03_b,eventC=Row_03_c |
Prerequisites
Before you complete the procedure in this guide, perform all of the following actions:
-
Create an Adobe Analytics destination. For more information, see Loading data into Adobe Analytics.
-
Find the name of the columns in the data extract that contain the Adobe Analytics events data.
Procedure
To create an enrichment script that will combine the events data into a single column, follow these steps:
-
Go to the Enrichments page.
-
In the top right corner, click + Create enrichment.
-
Click Custom Script.
-
(Optional) To assign the enrichment to individual datastreams of your choice, follow these steps:
-
In the Assign to section, select Individual datastreams.
-
In the drop-down menu, select the datastreams to assign the enrichment to them.
-
-
(Optional) To assign the enrichment to all existing and new datastreams that belong to Datastream Types of your choice, follow these steps:
-
In the Assign to section, select Datastreams Types.
-
In the drop-down menu, select the Datastream Types to assign the enrichment to all datastreams that belong to these types.
-
(Optional) In the Do not assign to these individual datastreams drop-down menu, select the individual datastreams that belong to the Datastream Types that you have selected, but you do not want to assign the enrichment to them.
-
-
Click Next.
-
In Select Instruction, enter and select addfieldx.
-
In Fieldname, enter the value events. This is the name of the new column that will be created using the enrichment instruction.
-
In Python Expression, enter the following code. Replace the values of
eventA
andeventB
with the corresponding Adobe Analytics events column names from the data extract (For example, these names could beclicks
andCTR
, orev_c
andev_crt
).'event01=' + {eventA} + ',' + 'event02=' + {eventB}
The example above concatenates just two columns of events data. If you have multiple columns of events data to load into Adobe Analytics, you must concatenate every event into a single column.
-
Click Next.
-
(Optional) In Enrichment name, rename the enrichment.
-
Click Create +.
As a result, the enrichment is created and can be applied to the relevant datastream.
Applying the enrichment to a datastream
To apply the enrichment to a datastream, follow these steps:
-
Go to the Datastreams page.
-
Click the datastream to which you want to apply the enrichment.
-
In the Enrichments section, click + Add Enrichment.
-
Click Assign Existing Enrichments.
-
To the right of the enrichment you want to apply to the datastream, click + Assign
-
In the top right corner of the page, click Close to close the Assign Enrichments window.
As a result, the enrichment is added to the datastream. Click Fetch now to collect data in the datastream with the applied enrichment to concatenate all the events data into a single line. Adverity places this line of events data in to the new column (events) in the data extract.