The dynamic content can be used for providing content that is targeted to specific interests of user or group of users.
As the result users will visit more pages and traffic and conversion rate will increase.
The banner ads or affiliate links can be also considered as content and obviously the targeted content
will work better.
For providing dynamic content we need to know user interests or some other information about users, somehow keep this data and some algorithm
for matching user data with available information of users data to select
the best content. This section will consider how it can be implemented
using perl.
Here is the simple exemple to start. Let assume that user visited page1 and page2. All pages have been mapped to keywords.
The page - keyword data is saved in the file, for example:
The dynamic content is also mapped to keywords, for example:
Our task is to find the content unit or units that are close to user data.
In matrix notation page - keyword data can be represented by matrix with one row for each page, and one column
for each keyword. We put 1 if the page has keyword and 0 if it does not have.
In similar way the content data can be represented by matrix with one row for content unit and columns for keywords.
The same keyword should have the same column index in both matrix.
Now if we multiply both matrix we get some similarity measure for each content unit.
To choose the best content we need to select the content with the highest similarity measure.
The above example is just simplified model. More complicated models can use weights instead of 0 and 1.
The weight can be derived from frequency keyword in the page or content and also based on how
long user viewed the page. Counting the number of the same pages (or keywords) visited by user can be
also used in the weights.
Programming Dynamic Content
The perl script for programming dynamic content is provided. It's tested with the page - keyword and content files
with the data that were shown before. One more file that is used is log file. At the minimum it has
to have visited page and ip. Here is the example of data file:
"-" replace some other fileds like time, browser type. The log file keeps information about users.
This information can be collected by many different ways. It could be cookies or webserver log file
or special database if users use login system or some script which saves visited page, ip and some other info to the log file shown above.
Here is the output of running script for our example data:
The output shows that the content3 unit is the best unit to display. The next conent unit is content1 unit.