There are two steps to enable personalized recommendations: collect user preferences and serve recommendations.
1) Collect user preferences
There are two kinds of preference collecting: page tracking and vote event tracking. For either of these methods, add this script tag on the page (usually at the end before closing body tag)
<script type="text/javascript" src="http://t.discovermy.net/track.js"></script>Page tracking
For simple item page tracking (e.g. user navigates to detail page), add this JavaScript command AFTER the above script tag.
<script type="text/javascript">
DMN.page({
app: "APPID",
item: "ABC123ITEM",
tags: ["blouse", "teen"],
type: "detail"
});
</script>Arguments
- app - application id issued to you by Discover My Network
- item - your id for the item user is looking at or voting on
- tags - optional: tags to filter recommendation on (see #2)
- type - it is useful for analysis and reporting to enter the type of page it is: detail, cart, purchase, share, replay, etc.
Vote event tracking
Rating controls are ideal for preference collecting (5 star rating control, thumbs up, etc.). Call the JavaScript command below when the vote event occurs. A "vote" is whenever a user indicates they like something (e.g. user rates 4 stars, watches video till end, shares with a friend, etc.).
<script type="text/javascript">
DMN.vote({
app: "APPID",
item: "ABC123ITEM",
rating: 0.5,
tags: ["blouse", "teen"]
});
</script>Arguments
- app - application id issued to you by Discover My Network
- item - the id for the item user is voting on
- rating - vote amount between 0.0 and 1.0 (e.g. 1 star is 0.0, 5 stars is 1.0)
- tags - optional tags to filter on for recommendations (see #2)
2) Serve Recommendations
To generate user recommendations, insert the below script tag at the end of the body (yet before other tracking scripts). This code will then dynamically convert a static list of products with personalized recommendations for that particular user.
<script type="text/javascript" src="http://r.discovermy.net/recommend?app=CUSTOMER&selector=%23main_content%20.item&tag=blouses"></script>Arguments
- app - customer id issued to you by Discover My Network
- selector - CSS SELECTOR string to the list of products to convert to personalized recommendations. Note: the hash (#) mark for id is escaped as %23 and spaces are escaped as %20
- tag - optional: recommend items for a tag. These tags must be set during Collect User Preferences phase.
