Page tree
Skip to end of metadata
Go to start of metadata

The integration of Gravity's recommendation engine requires the following main tasks to be carried out. There are several alternatives for each step and you can choose the option that best fits your situation based on your existing system architecture.

 

Item catalog

For the recommendation engine, an "item" is anything that can be recommended. Items are identified by a unique ID and they can have as many custom attributes as required.

Attributes are used for:

  • Meta-data based recommendations
  • Business rules filtering
  • Optimizing the recommendations by feeding them back into the system from other areas

Item Anatomy

Item Property
Description
itemIdUnique identifier for the item (string)
titleName/title of the item
hiddenIs the item currently recommendable
<custom_property>

Any additional information about the itemlike: url, categoryPath, description, author, color, ...

 e-commerce site
Attribute nameExample valueTypeDescription
categoryPathMultimedia/TelephoneStringThe category hierarchy of the item separated by '/'

categoryId

1455StringThe unique identifier of the items category.
urlwww.items.com/item_123StringUrl of the item page.
imageUrlwww.items.com/img/item_123StringUrl of the item's image.
descriptionThis is the description of the example item.StringLonger description of the item.
price3450StringThe price of the item.
 classified site

For all items:

Attribute nameExample valueTypeDescription
companyAd0BooleanIs the item advertised by a company or a natural person.
adTypesellStringIs the item forsellor rent.
categoryPathMultimedia/TelephoneStringThe category hierarchy of the item separated by '/'

categoryId

1455StringThe unique identifier of the items category.
urlwww.items.com/item_123StringUrl of the item page.
imageUrlwww.items.com/img/item_123StringUrl of the item's image.
descriptionThis is the description of the example item.StringLongerdesciptionof the item.
price3450StringThe price of the item.


For some specific categories:

For real-estate items:

Attribute nameExample valueTypeDescription
rooms3IntegerThe number of rooms present in the real-estate item.

size

67IntegerThe size of the real-estate item in m2
lot340IntegerThe size of the lot belonging to the real-estate item in m2
cityLondonStringThe city the real-estate item is located in.
areaSouth-BankStringThe are the real-estate item is located in


For automobile items:





year1989IntegerThe year the auto-mobile item was registered in.

milage

200000IntegerThe number of kms the auto-mobile item has driven.
fuelbenzineStringThe fuel type of the auto-mobile item.
brandBMWStringThe brand of the auto-mobile item.
colorblueStringThe color of the auto-mobile item.
 video streaming site

Some general attributes:

Attribute nameExample valueTypeDescription
categoryPathMultimedia/TelephoneStringThe category hierarchy of the item separated by '/'

categoryId

1455StringThe unique identifier of the items category.
urlwww.items.com/item_123StringUrl of the item page.
imageUrlwww.items.com/img/item_123StringUrl of the item's image.
descriptionThis is the description of the example item.StringLonger description of the item.


Some video specific attributes:

Attribute nameExample valueTypeThe length of the video item in seconds.
length600StringThe length of the video item in seconds.
genreactionStringThe genre of the video item.
typefilmStringThe type of the video item.
rating3.4DoubleThe rating of the video item.
actorBruce WillisStringThe actor of the video item.
actorVoiceRumi HiiragiStringThe voice actor of the video item.
directorQuentin TarantinoStringThe producer of the video item.
languageEnglishStringThe audio language of the video item.
subtitlesGermanStringThe subtitle language of the video item.

File-based item catalog update

You can provide an item catalog for Gravity using a TSV or XML (RSS 2.0 - Google Merchant) file. The catalog file should be made available over HTTP/HTTPS/FTP and it will be periodically imported into our database.

 sample item catalogs

Check out the sector specific sample files:

e-commerce:


classified:


video streaming:

Crawling

Gravity can also process your site directly to build the item catalog. This means that as soon as there is at least one user event on a certain item, it will be passed over to the Gravity database with all its visible metadata. By "visible", I mean visible and accessible to our crawling engine from the HTML code (machine-readable format). This way we can build up the site-specific item catalog on our own. 

For this, you might need to add the item data to your site with hidden HTML tags in a machine readable format. 

Note

Using the crawling methodology, the item deletion is not synchronized immediately. If you would like to have an immediate deleted item synchronization then you should implement an extra server-side API call (see below)

Server-side API item catalog update

For special cases, e.g. if every second counts and very frequent item updates are needed updates are needed (as is the case for classified sites or video streaming sites) you can use direct server-side API calls. We have ready-made client libraries for Java and PHP. For other programming languages, the REST API is available.

For more details please visit the following pages:

Java client
PHP client
REST API

User catalog

A user is defined as the end user of the website.

Users are identified by a unique ID and they can have as many custom attributes as required.

Attributes are used for:

  • meta-data based recommendations
  • filtering using business rules

User Anatomy

User Property
Description
userIdUnique identifier for the user
<custom_property>Any additional information about the user, e.g.
  • gender
  • birthYear
  • city
  • zip

 

File-based user catalog update

You can provide user catalogs to Gravity using a TSV. The catalog file should be made available over HTTP/HTTPS/FTP and it will be periodically imported into our database.

 sample user catalog

userId

gender
birthYear
city
zip
1female1980Budapest1123
2male1981London10234

 

Server-side API user catalog update

For special cases e.g. if every second counts and very frequent user updates are needed you can use direct server side API calls. We have ready-made client libraries for Java and PHP. For other programming languages REST API is available.

For more details please visit the following pages:

Java client
PHP client
REST API

Behavior tracking

 Gravity uses events for tracking user interactions. Events are collected on our server and are used to build user profiles to provide personalized recommendations.

Event Anatomy

Event Property
Description
userIdID for logged in users
cookieIdID for guests
(For mobile devices, send deviceId as cookieId) 
itemIdID of the subject of the event
eventType

Type of the events, e.g. VIEW, BUY, ADD_TO_CART

 E-commerce event types

The list of supported event types is predefined, and the most commonly used E-commerce related types are summarized in the table below.

Events can have arbitrarily many custom attributes, called name-value pairs. These name-value pairs allow to pass any information about the events. The table below describes the suggested name values for the specific event types.

 

Event TypeDescriptionNameValues for the event
VIEWThe user viewed the info page of an item.

BUY   The user bought an item.   orderId 
unitPriceFormatted as a decimal number, for example 1234 or 12345.67
currency 
quantityFormatted as a decimal number.
RATINGThe user rated an item.valueThe value of the rating.
ADD_TO_CARTThe user added an item to the shopping cart.quantity 
REMOVE_FROM_CARTThe user removed an item from the shopping cart.quantity 
ADD_TO_FAVORITESThe user added the item to his/her favorites.listIdUse if the webshop supports multiple favorites lists.
REMOVE_FROM_FAVORITESThe user removed an item from his/her favorites.listIdUse if the webshop supports multiple favorites lists.
REC_CLICKThe user clicked on a recommended item.positionThe position of the clicked item in the recommendation list. The position of the first item is 1.
SEARCH  A list of products was displayed to the user, for example by browsing a category or by free text search.  searchString 
filter.*If the listing is based on comparing an item namevalue to a filter value, you can provide the actual filter here.For example, if the user was browsing a specific category, name='Filter.CategoryId' and value='CategoryA' can be specified.

 Classified event types

The list of supported event types is predefined, and the most commonly used Classified related types are summarized in the table below.

Events can have arbitrarily many custom attributes, called name-value pairs. These name-value pairs allow to pass any information about the events. The table below describes the suggested name values for the specific event types.

 

Event TypeDescriptionNameValues for the event
VIEWThe user viewed the info page of an item.

PHONE_CLICKThe user clicks on the show phone number button. 
LETTER_SENDThe user sent a message to the advertiser.

RATINGThe user rated an item.valueThe value of the rating.
ADD_TO_FAVORITESThe user added the item to his/her favorites.listIdUse if the webshop supports multiple favorites lists.
REMOVE_FROM_FAVORITESThe user removed an item from his/her favorites.listIdUse if the webshop supports multiple favorites lists.
REC_CLICKThe user clicked on a recommended item.positionThe position of the clicked item in the recommendation list. The position of the first item is 1.
SEARCH

A list of products was displayed to the user, for example by browsing a category or by free text search.

searchString 
filter.*If the listing is based on comparing an item namevalue to a filter value, you can provide the actual filter here.For example, if the user was browsing a specific category, name='Filter.CategoryId' and value='CategoryA' can be specified.

 Video streaming event types

The list of supported event types is predefined, and the most commonly used Video streaming related types are summarized in the table below.

Events can have arbitrarily many custom attributes, called name-value pairs. These name-value pairs allow passing any information about the events. The table below describes the suggested name values for the specific event types.

 

Event TypeDescriptionName-values for the event
VIEWThe user viewed the video detail page.  
RATINGThe user rated an item.valueThe value of the rating.
ADD_TO_FAVORITESThe user added the item to his/her favorites.listIdUse if the webshop supports multiple favorites lists.
REMOVE_FROM_FAVORITESThe user removed an item from his/her favorites.listIdUse if the webshop supports multiple favorites lists.
REC_CLICKThe user clicked on a recommended item.positionThe position of the clicked item in the recommendation list. The position of the first item is 1.
SEARCH  A list of products was displayed to the user, for example by browsing a category or by free text search.  searchString 
filter.*If the listing is based on comparing an item name-value to a filter value, you can provide the actual filter here.
For example, if the user was browsing a specific category, name='Filter.CategoryId' and value='CategoryA' can be specified.
FREE_VIEWThe user watched an item for free.  
PAID_VIEW The user paid for watching/listening an item. valueHow much the user paid for watching the item. A decimal number.
SUBSCRIPTION_VIEWThe user watched an item that was available for her by a subscription.  
WATCH_LIVEThe user watched a percentage of a video.percentageThe percentage the user watched the video.
PREMIUM_VIEW The user paid for premium content when watching an item. valueHow much the user paid for watching the item. A decimal number.

timeThe time when the event occurred in UNIX timestamp format
recommendationIdFor REC_CLICK, the id of the recommendation placement, where the item was clicked.
Used for conversion tracking. 
<custom_property>Additional event attributes, such as price and orderId for BUY events

File-based initial event upload

You can provide historical events for Gravity uses a TSV file. It can be uploaded to RECO using the Dash. This should be used for transactional type events like BUY. 

  sample event catalog
userId
itemId
cookieId
time
eventType
orderId
unitPrice
quantity
currency
12123
13cc9c746e5-a899a80c7a067beb
1285578547
BUY
O-234
1000.202EUR
123 456
13cd10a5f49-5885b759437f0ccd
1285579547
BUY
O-236
2300.303USD

Where a value is missing (such as userId) the content for that should be left empty (instead of missing, null and such attributes). 

You can add event specific meta information by adding additional columns.


Automated event tracking

This is the most simple way of sending events. As you only have to include Gravity's JS library. The event tracking does not require any further action from your side. The tracking code is injected by Gravity.

 code sample

The communication between the recommendation engine and the customer's site is implemented by asynchronous JavaScript calls directly between the user's browser and the recommendation engine. 

First, you need to bootstrap our system by adding the following code to the webpage (this will load and setup our JS library). Paste this snippet into your website template page so that it appears before the closing </head> tag.

JavaScript initialization code
<head>
    [...]
<script>
	(function(g,r,a,v,i,t,y){
		g[a]=g[a]||[],y=r.createElement(v),
		g=r.getElementsByTagName(v)[0];y.async=1;
		y.src='//'+i+'/js/'+t+'/gr_reco5.min.js';
		g.parentNode.insertBefore(y,g);y=r.createElement(v),y.async=1;
		y.src='//'+i+'/grrec-'+t+'-war/JSServlet4?cc=1';
		g.parentNode.insertBefore(y,g);
	})(window, document, '_gravity','script', '<CUSTOMERID>-<SERVERLOCATION>.gravityrd-services.com', '<CUSTOMERID>');
</script>
</head>

You should replace CUSTOMERID with your partner identifier and SERVERLOCATION with the gravity cluster name!

(The library will register a global object named "GravityRD". Except this object, which is necessary we don't pollute your namespace.)

For debugging reasons, a non-minimized version of the library is also available, named: gr_reco5.js

JS event tracking

You can initiate events using our JS API. This gives you more control over user tracking but more advanced coding is required. In addition to including Gravity's JS fragment, you should trigger the events by JS calls. Some of the work like cookie tracking and associating the events to recommendations, is still done automatically.

 E-commerce sample code

The communication between the recommendation engine and the customer's site is implemented by asynchronous JavaScript calls directly between the user's browser and the recommendation engine. 

First, you need to bootstrap our system by adding the following code to the webpage (this will load and setup our JS library). Paste this snippet into your website template page so that it appears before the closing </head> tag.

JavaScript initialization code
<head>
    [...]
<script>
	(function(g,r,a,v,i,t,y){
		g[a]=g[a]||[],y=r.createElement(v),
		g=r.getElementsByTagName(v)[0];y.async=1;
		y.src='//'+i+'/js/'+t+'/gr_reco5.min.js';
		g.parentNode.insertBefore(y,g);y=r.createElement(v),y.async=1;
		y.src='//'+i+'/grrec-'+t+'-war/JSServlet4?cc=1';
		g.parentNode.insertBefore(y,g);
	})(window, document, '_gravity','script', '<CUSTOMERID>-<SERVERLOCATION>.gravityrd-services.com', '<CUSTOMERID>');
</script>
</head>

You should replace CUSTOMERID with your partner identifier and SERVERLOCATION with the gravity cluster name!

(The library will register a global object named "GravityRD". Except this object, which is necessary we don't pollute your namespace.)

For debugging reasons, a non-minimized version of the library is also available, named: gr_reco5.js

event tracking
 _gravity = _gravity || [];
_gravity.push({type: 'set', userId: 'user1234'});
// searching for an item
_gravity.push({type: 'event', eventType: 'SEARCH', filter.categoryId: "4", filter.minPrice: "15", filter.maxPrice: "45"});
// clicking on a recommendation box
_gravity.push({type: 'event', eventType: 'REC_CLICK', itemId: "item123"});
// viewing the item the user clicked on in the recommendation box.
_gravity.push({type: 'event', eventType: 'VIEW', itemId: "item123"});
// adding the item to the user's cart.
_gravity.push({type: 'event', eventType: 'ADD_TO_CART', itemId: "item123", quantity: "1"});
// also adding another item to the user's cart.
_gravity.push({type: 'event', eventType: 'ADD_TO_CART', itemId: "item146", quantity: "2"});
// buying the items from the cart.
_gravity.push({type: 'event', eventType: 'BUY', itemId: "item123", quantity: "1", orderId: "566443", unitPrice: "34"});
_gravity.push({type: 'event', eventType: 'BUY', itemId: "item146", quantity: "2", orderId: "566443", unitPrice: "24"});
  Classified sample code

The communication between the recommendation engine and the customer's site is implemented by asynchronous JavaScript calls directly between the user's browser and the recommendation engine. 

First, you need to bootstrap our system by adding the following code to the webpage (this will load and setup our JS library). Paste this snippet into your website template page so that it appears before the closing </head> tag.

JavaScript initialization code
<head>
    [...]
<script>
	(function(g,r,a,v,i,t,y){
		g[a]=g[a]||[],y=r.createElement(v),
		g=r.getElementsByTagName(v)[0];y.async=1;
		y.src='//'+i+'/js/'+t+'/gr_reco5.min.js';
		g.parentNode.insertBefore(y,g);y=r.createElement(v),y.async=1;
		y.src='//'+i+'/grrec-'+t+'-war/JSServlet4?cc=1';
		g.parentNode.insertBefore(y,g);
	})(window, document, '_gravity','script', '<CUSTOMERID>-<SERVERLOCATION>.gravityrd-services.com', '<CUSTOMERID>');
</script>
</head>

You should replace CUSTOMERID with your partner identifier and SERVERLOCATION with the gravity cluster name!

(The library will register a global object named "GravityRD". Except this object, which is necessary we don't pollute your namespace.)

For debugging reasons, a non-minimized version of the library is also available, named: gr_reco5.js

event tracking
 _gravity = _gravity || [];
_gravity.push({type: 'set', userId: 'user1234'});
// searching for an item
_gravity.push({type: 'event', eventType: 'SEARCH', filter.categoryId: "4", filter.minPrice: "15", filter.maxPrice: "45"});
// clicking on a recommendation box
_gravity.push({type: 'event', eventType: 'REC_CLICK', itemId: "item123"});
// viewing the item the user clicked on in the recommendation box.
_gravity.push({type: 'event', eventType: 'VIEW', itemId: "item123"});
// adding the item to the user's favorites.
_gravity.push({type: 'event', eventType: 'ADD_TO_FAVORITES', itemId: "item123"});
// also adding another item to the user's favorites.
_gravity.push({type: 'event', eventType: 'ADD_TO_FAVORITES', itemId: "item146"});
// the user contacts the item's vendors.
_gravity.push({type: 'event', eventType: 'LETTER_SEND', itemId: "item123"});
_gravity.push({type: 'event', eventType: 'LETTER_SEND', itemId: "item146"});
// the user rates an item.
_gravity.push({type: 'event', eventType: 'RATE', itemId: "item146", value: "4"});
  Video streaming sample code

The communication between the recommendation engine and the customer's site is implemented by asynchronous JavaScript calls directly between the user's browser and the recommendation engine. 

First, you need to bootstrap our system by adding the following code to the webpage (this will load and setup our JS library). Paste this snippet into your website template page so that it appears before the closing </head> tag.

JavaScript initialization code
<head>
    [...]
<script>
	(function(g,r,a,v,i,t,y){
		g[a]=g[a]||[],y=r.createElement(v),
		g=r.getElementsByTagName(v)[0];y.async=1;
		y.src='//'+i+'/js/'+t+'/gr_reco5.min.js';
		g.parentNode.insertBefore(y,g);y=r.createElement(v),y.async=1;
		y.src='//'+i+'/grrec-'+t+'-war/JSServlet4?cc=1';
		g.parentNode.insertBefore(y,g);
	})(window, document, '_gravity','script', '<CUSTOMERID>-<SERVERLOCATION>.gravityrd-services.com', '<CUSTOMERID>');
</script>
</head>

You should replace CUSTOMERID with your partner identifier and SERVERLOCATION with the gravity cluster name!

(The library will register a global object named "GravityRD". Except this object, which is necessary we don't pollute your namespace.)

For debugging reasons, a non-minimized version of the library is also available, named: gr_reco5.js

event tracking
_gravity = _gravity || [];
_gravity.push({type: 'set', userId: 'user1234'});
// searching for an item
_gravity.push({type: 'event', eventType: 'SEARCH', filter.categoryId: "4", searchString: "Game of Thrones"});
// clicking on a recommendation box
_gravity.push({type: 'event', eventType: 'REC_CLICK', itemId: "item123"});
// viewing the item the user clicked on in the recommendation box.
_gravity.push({type: 'event', eventType: 'VIEW', itemId: "item123"}); 
// adding the item to the user's favorites.
_gravity.push({type: 'event', eventType: 'ADD_TO_FAVORITES', itemId: "item123"});
// also adding another item to the user's favorites.
_gravity.push({type: 'event', eventType: 'ADD_TO_FAVORITES', itemId: "item146"});
// the user views these 2 items.
_gravity.push({type: 'event', eventType: 'FREE_VIEW', itemId: "item123"});
_gravity.push({type: 'event', eventType: 'FREE_VIEW', itemId: "item146"});
// the user rates an item.
_gravity.push({type: 'event', eventType: 'RATE', itemId: "item146", value: "4"});


Server-side event tracking

We provide different server side APIs which can be used for tracking user events. Use the server-side API, only if none of the other methods are applicable.

For more details please visit the following pages:

Java client
PHP client
REST API

On-site recommendations

Prerequisites

Description

Recommendation Request/Response Anatomy

Request Parameters
Description
scenarioId

Used to select the most appropriate algorithm and to filter settings for the current page type and box location.

 Scenario examples

 E-commerce examples
Scenario NameDescription
MAIN_PAGERecommended items are displayed on the main page.
CATEGORY_PAGERecommended items are displayed on a category browsing page where usually only items from the specific category are displayed.
LISTING_PAGERecommended items are displayed on a page where several items are listed e.g. as a result of a search query.
ITEM_PAGE_RELATEDRecommended items are displayed on an item details page where detailed information can be found about an exact item. Emphasize items from related categories.
ITEM_PAGE_SIMILARRecommended items are displayed on an item details page where detailed information can be found about an exact item. Emphasize similar items.
 Classified example
Scenario NameDescription
MAIN_PAGERecommended items are displayed on the main page.
CATEGORY_PAGERecommended items are displayed on a category browsing page where usually only items from the specific category are displayed.
LISTING_PAGERecommended items are displayed on a page where items several item is listed e.g. as a result of a search query.
ITEM_PAGE_RELATEDRecommended items are displayed on an item details page where detailed information can be found about an exact item. Emphasize items from related categories.
ITEM_PAGE_SIMILARRecommended items are displayed on an item details page where detailed information can be found about an exact item. Emphasize similar items.
AFTER_ADREPLYRecommended items are displayed on item details page after succesful contact has been estabilished with the vendor.
 Video streaming example
Scenario NameDescription
MAIN_PAGERecommended videos are displayed on the main page.
CATEGORY_PAGERecommended videos are displayed on a category browsing page where usually only items from the specific category are displayed.
LISTING_PAGERecommended videos are displayed on a page where several videos are listed e.g. as a result of a search query.
VIDEO_RELATEDRecommended videos are displayed on an video page where detailed information can be found about an exact item. Emphasize items from related categories.
VIDEO_PAGE_SIMILARRecommended videos are displayed on an video page where detailed information can be found about an exact item. Emphasize similar items.
PLAYER_RELATEDRecommended videos are displayed on an video page where detailed information can be found about an exact item. Results are displayed after finishing the video.
 

userIdIdentifier of the current user.
cookieIdIdentifier for guests or users that are not logged in.
numberLimitThe number of requested items.
currentItemIdUsed on item pages to pass the ID of the current item to the engine.
<custom_parameters>

Any additional parameter used for filtering e.g.

  • current category
  • search string
  • list of items already visible on the page
  • list of items which can be recommended
  • ...
<item_properties>Gravity can return selected properties of the recommended items to make the generation of recommendations easier. These properties has to be listed in the request:
  • url
  • imageUrl
  • title
  • ... 

 

 

Response Parameters
Description
recommendationIdUnique identifier for every recommendation response.
itemIdsThe list of IDs of the recommended items.
itemPropertiesThe value of each property listed in the request for the recommended items.

Injected Recommendation Box

If you don't want the hassle of implementing the recommendation boxes yourself, Gravity is able to render it on your site. After including our JS on your site, you just need to approve the box design, and the recommendations will be displayed with no further work needed.

 code sample

The communication between the recommendation engine and the customer's site is implemented by asynchronous JavaScript calls directly between the user's browser and the recommendation engine. 

First, you need to bootstrap our system by adding the following code to the webpage (this will load and setup our JS library). Paste this snippet into your website template page so that it appears before the closing </head> tag.

JavaScript initialization code
<head>
    [...]
<script>
	(function(g,r,a,v,i,t,y){
		g[a]=g[a]||[],y=r.createElement(v),
		g=r.getElementsByTagName(v)[0];y.async=1;
		y.src='//'+i+'/js/'+t+'/gr_reco5.min.js';
		g.parentNode.insertBefore(y,g);y=r.createElement(v),y.async=1;
		y.src='//'+i+'/grrec-'+t+'-war/JSServlet4?cc=1';
		g.parentNode.insertBefore(y,g);
	})(window, document, '_gravity','script', '<CUSTOMERID>-<SERVERLOCATION>.gravityrd-services.com', '<CUSTOMERID>');
</script>
</head>

You should replace CUSTOMERID with your partner identifier and SERVERLOCATION with the gravity cluster name!

(The library will register a global object named "GravityRD". Except this object, which is necessary we don't pollute your namespace.)

For debugging reasons, a non-minimized version of the library is also available, named: gr_reco5.js

JS API call

If you want more control over the rendering of the recommendations,  or you would like to display recommendations in existing elements, you can use our JS library for handling asynchronous recommendation requests.

 code sample

The communication between the recommendation engine and the customer's site is implemented by asynchronous JavaScript calls directly between the user's browser and the recommendation engine. 

First, you need to bootstrap our system by adding the following code to the webpage (this will load and setup our JS library). Paste this snippet into your website template page so that it appears before the closing </head> tag.

JavaScript initialization code
<head>
    [...]
<script>
	(function(g,r,a,v,i,t,y){
		g[a]=g[a]||[],y=r.createElement(v),
		g=r.getElementsByTagName(v)[0];y.async=1;
		y.src='//'+i+'/js/'+t+'/gr_reco5.min.js';
		g.parentNode.insertBefore(y,g);y=r.createElement(v),y.async=1;
		y.src='//'+i+'/grrec-'+t+'-war/JSServlet4?cc=1';
		g.parentNode.insertBefore(y,g);
	})(window, document, '_gravity','script', '<CUSTOMERID>-<SERVERLOCATION>.gravityrd-services.com', '<CUSTOMERID>');
</script>
</head>

You should replace CUSTOMERID with your partner identifier and SERVERLOCATION with the gravity cluster name!

(The library will register a global object named "GravityRD". Except this object, which is necessary we don't pollute your namespace.)

For debugging reasons, a non-minimized version of the library is also available, named: gr_reco5.js

recommendation request
_gravity.push({type : 'recommendation', callback: callback_fn, numberLimit: 5, scenarioId: "ITEM_PAGE", currentItemId: "28080"});

You can find detailed information here.

 

Server-side API call

IMPORTANT NOTE: Please keep in mind that trough network error or through other unexpected issues may an error occurs while getting the recommendation from or while adding events to the recommendation engine. This error can cause a program exception which always has to be handled in the proper way. Without handling the possible exceptions your code may terminate at an unexpected place and your site will operate abnormally. Even if you do not get a valid list of recommended items as a result of the recommendation request take care about hiding the recommendation widget or filling it with relevant items. Please ensure the safe error handling. Gravity does not take any responsibility for any damages caused by the lack or deficiency of error handling

 

If, for some reason, JS is not a possibility for you, Gravity also provides server-side API for recommendation requests.

For more details please visit the following pages:

Java client
PHP client
REST API

Newsletter recommendations

Prerequisites

Image based integration

This is the simplest way of displaying personalized content in your e-mails, however not suitable for subject line personalization. You only have to:

  • Add some HTML tags to your e-mails.
image based newsletter recommendation
<a href="http://<customer>-<location>.gravityrd-services.com/grrec-<customer>-war/AdServlet?action=renderrd&pos=<imagepos>&scenarioId=newsletter1&userid=<userid>&timestamp=1384529880325">
<img src="http://<customer>-<location>.gravityrd-services.com/grrec-<customer>-war/AdServlet?action=renderrec&pos=<imagepos>&scenarioId=newsletter1&userid=<userid>&timestamp=1384529880325">
</a>
  • where you have to replace:
    • <customer> - with your unique customer identifier (provided by Gravity)

    • <location> - the location of your service (provided by Gravity)

    • <imagepos> - a number from 1 to the number of displayed recommendation. This is number of the actual items in the list of recommended items.

    • <userid> - the identifier of the user the email is sent to.

  • Connecting users in your newsletter service with your users on your site. This simply means you have to upload both ID or also the user’s email address into our user catalog.

  • Specify the design. The recommendations will appear in your newsletter as images but this images are server side rendered HTML contents so they can contain any images and formatted text blocks.

Direct newsletter integration

If you are using one of the compatible newsletter services, you can apply our direct integration to it.  

We already in co-operation with the following newsletter services:

Other compatible newsletter services:

For integration with services not listed above, please contact us at sales@gravityrd.com

Batch processing

For in-house newsletter solutions, we provide an XML-based batch processing API to allow efficient processing of large number of recommendation requests.

 

Advanced newsletter functions

  • Personalized sending time
  • Personalized newsletter content
  • Reactivation mails
  • Transactional mails

For more info please contact us at sales@gravityrd.com

  • No labels