I am doing a POC for Personalization in DD4T, where I want to store the information of the Pages, and Components visited and to fill the Tracking_Keys
table for a session user. I want to use this data to personalize the content.
I am using the below code to store the Keys
//For tracking the page and component visits
var waiPage = new WAIPage(pgModel.Id, this.HttpContext.ApplicationInstance.Context);
//For Storing the Tracking Key
Tridion.ContentDelivery.Web.WAI.TrackingKeys trackingKey = new TrackingKeys(waiPage.User);
trackingKey.IncrementKey(keyword);
trackingKey.SetKey(keyword, 8);
trackingKey.ExecuteUpdate();
The cd_wai_conf.xml
is below here
<?xml version="1.0" encoding="UTF-8"?>
<Configuration Version="7.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_wai_conf.xsd">
<Global>
</Global>
<Presentations>
<Presentation Id="1">
<Host Domain="localhost" Port="3035" Protocol="http" Path="/"/>
<Personalization Enabled="true" Persistence="cookies">
<Cookie Name="TDS1234" Expires="39000"/>
<Tracking>
<Timeframe Type="hourly" Multiplier="1" Autofill="true"/>
<Pages Enabled="true"/>
<Components Enabled="true" Max="10" Averaging="true"/>
<ComponentLinks Enabled="true"/>
<Keys Enabled="true" Increment="50" Decrement="1" Averaging="false" ComponentLinks="true"/>
<Exclude>
<Pages></Pages>
<Components/>
<Paths/>
</Exclude>
</Tracking>
<CustomerCharacteristics PreserveWhitespace="true"/>
</Personalization>
</Presentation>
</Presentations>
</Configuration>
Also I have added the entry in to the cd_storage_config.xml
<ItemTypes defaultStorageId="defaultdb" cached="false">
<Item typeMapping="Personalization" cached="false" storageId="defaultdb"/>
</ItemTypes>
With this configuration whenever I am requesting a page, the Page and the corresponding Component IDs are stored in the Page_visits
and the Component_Visits
table for the particular session user, and the Visit_Value
column value increases with every page request. In the Tracking_Keys
table the Keyword
the value is stored as 400
for each keyword as I have set the Key
as 8
and the Increment
value as 50
.
Is there any class or method to fetch this information [page visit/component visit value]
from the Broker in DD4T?
Update 1:
In our case the tracking_key
Value is not changing on the basis of page_visit/component_visit
as the Increment(50)
& the Key(8)
values remain same.
So by using the code trackingKey.GetKey(keyCond.Keyword.Key)
I am getting only 8].
To set the Key value as dynamic (using the Page_visit/component_visit value) , I need to read the Page_visit/component_visit
value.
or is there any other way to handle this functionality?