Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Recommendations so run the code below in your application to see the widget suggestions. It will return product suggestions in the form of a json object.

zoneId: The value of the ZoneID parameter in the url of the widget page you created in the RMC panel.

productCode: The product code to be taken as a basis in the product-based suggestion system. It must be the same as the product code value sent to us on your other integrations.
properties: Parameters used to make general filters such as category. It is of type Object, it takes a key=value value.
filter: Value in array data type used to fetch products based on certain criteria.

visilabsApi.getRecommendations(zoneId, productCode, properties, filter)


Use

import {VisilabsApi, RecommendationAttribute, RecommendationFilterType} from 'react-native-related-digital'
const visilabsApi = new VisilabsApi(appAlias, siteId, organizationId, dataSource)
  
const getRecommendations = async () => {
    try {
      const zoneId = '6'
      const productCode = ''
      
      const properties =  {
        "OM.cat":"65" // Category code
      }

      // optional
      const filters = [{
        attribute: RecommendationAttribute.PRODUCTNAME,
        filterType: RecommendationFilterType.like,
        value: 'laptop'
      }]

      const recommendations = await visilabsApi.getRecommendations(zoneId, productCode, properties, filters)
      // const recommendations = await visilabsApi.getRecommendations(zoneId, productCode, properties)
      
      console.log('recommendations', recommendations)
    }
    catch (e) {
      console.log('recommendations error', e)
    }
  }

Example Json

{
    "recommendations": [
        {
            "attr1": "420494",
            "attr10": "",
            "attr2": "",
            "attr3": "",
            "attr4": "",
            "attr5": "",
            "attr6": "",
            "attr7": "",
            "attr8": "",
            "attr9": "",
            "brand": "Related Digital",
            "code": "1159092",
            "comment": 0,
            "cur": "TRY",
            "dcur": "TRY",
            "dest_url": "https://relateddigital.com/example-product?OM.zn=You%20Viewed-w60&OM.zpc=1159092",
            "discount": 0,
            "dprice": 5.25,
            "freeshipping": false,
            "img": "https://cdn.relateddigital.com/example.png",
            "price": 5.25,
            "qs": "OM.zn=You Viewed-w60&OM.zpc=1159092",
            "rating": 0,
            "samedayshipping": false,
            "title": "Titiz TP-115 Soba Boru Fırçası Yeşil"
        }
    ],
    "title": "Display You Viewed"
}

The following values will be returned for each product.

Feature

Data Type

code

String

title

String

img

String

dest_url

String

brand

String

price

Double

dprice

Double

cur

String

dcur

String

freeshipping

Bool

samedayshipping

Bool

rating

Int

comment

Int

discount

Double

attr1

String

attr2

String

attr3

String

attr4

String

attr5

String

attr6

String

attr7

String

attr8

String

attr9

String

attr10

String

qs

String

If you want to access widget-related reports from the RMC panel, run the following function on each product click via the widget.

qs: getRecommendations The response returned from the function is available in every product in it. You should pass the qs parameter of the clicked product as a parameter to this function.

visilabsApi.trackRecommendationClick(qs)

Next Step

  • No labels