PRODUCT
Follow

adkit.getSVData(svKey)

Description

Retrieves the smart item value according to key.

Example

    adkit.onReady(function(){
          var logoUrl = adkit.getSVData('logo');
    });

Parameters

Name Mandatory/Optional Type Description
svKey Mandatory String SV key as declared in the SV schema within the AdKit configuration file

Response Example

Depends on the data type that was declared for the specified smart item.

adkit.clickedVersion(versionIndex, url)

Description

Invokes the click-through URLs specified for this catalog version/product. Used to trigger a click-through and associate it with a specific catalog product/version.

Example

     adkit.onReady(function(){
         document.getElementById("product1").addEventListener('click', function(){
            adkit.clickedVersion(1, "http://host/path");
        });
     });

Parameters

Name Mandatory/Optional Type Description
versionIndex Mandatory Integer

Catalog version/product index.

url Optional String

Click-through URL.

adkit.getVersions(startIndex, endIndex, readyCB)

Description

Returns the requested catalog versions/products either as an argument of the callback function or null if the catalog versions/products cannot be acquired.

If the endIndex is not specified, it will be equal to the catalog versions/products count.

Example

   adkit.onReady(function(){
        adkit.getVersions(1, 5, function(versions
                  if (versions){
                          for (var i=versions.startVersionNum; i<=versions.endVersionNum; i++){
                               var version = versions.versionData[i];
                               var value = version["logo"].value;
                          }
                   }
        });
    });

Parameters

Name Mandatory/Optional Type Description
startindex
Mandatory Integer

Index of the first catalog version/product to acquire.

endIndex
Optional Integer

Index of the last catalog version/product to acquire.

If not specified, catalog versions/products count will be used. 

readyCB
Mandatory Function

Executed when all the requested catalog versions/products are ready.

 

readyCB Function Parameters

Name Mandatory/Optional Type Description
versionsInfo
Mandatory Object

Information for requested catalog versions/products.

 

versionsInfo Object Properties

Name Mandatory/Optional Type Description
startVersionNum
Mandatory Integer

Index according to the first catalog version/product.

endVersionNum
Mandatory Integer

Index according to the last catalog version/product

versionData
Mandatory Object

This object holds all retrieved catalog versions/products.

You can access a catalog version/product object using the version index.

For Example:
versionInfo.versionData[versionInfo.startVersionNum]

versions/product Object 

The version/product object contains smart items objects.

The smart items objects can be accessed using the smart item key that was declared in the SVCatalog schema in the AdKit configuration file.

Example
     versionInfo.versionData[versionInfo.startVersionNum][key]

Smart Item Object

The smart item object contains a dynamic value which can be accessed using its "value" property.

Example
   versionInfo.versionData[versionInfo.startVersionNum][key].value

adkit.getVersionCount()

Description

Returns the number of viable catalog versions/products returned by the ad server.

Example

    adkit.onReady(function(){
        var catalogVersionsCount = adkit.getVersionCount();
    }); 

getVersionCount Object Properties

Name Mandatory/Optional Type Description
getVersionCount
Mandatory Integer

Number of viable catalog versions/products.

 

adkit.getMinVersions()

Description

Returns the value defined for minimum versions to load. 

Example

adkit.onReady(function(){
   var minVersionsToLoad = adkit.getMinVersions();
});

Return:

      type: integer

adkit.getVersionDataByKey(versionIndex, key, readyCB)

Description

Returns the smart item object for catalog version/product index and smart item key combination (null if not defined) as an argument of the callback function. 
This is used to retrieve specific smart item data from a specific catalog version/product, rather than the entire catalog version/product. 

Example


adkit.onReady(function(){
       adkit.getVersionDataByKey(1, "logo", function(smartItem){
              if (smartItem) {
                  var value = smartItem.value;
              }         
         });
  }); 

Parameters

Name Mandatory/Optional Type Description
versionIndex Mandatory Integer Index of the requested version/product.
key Mandatory String A key for the requested smart item.
readyCB Mandatory Function This function runs when the smart item is ready.

readyCB Function Parameters

Name Mandatory/Optional Type Description
smartItem Mandatory Object Smart item object (can be null).

Smart Item Object

The smart item dynamic value can be accessed using its value property.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments