//Initializing Smart Script arguments var oneLinkURL = "https://engmntqa.onelink.me/LtRd/"; // If a media source key is NOT FOUND on the link and NO default value is found, the script will return a null string var mediaSource = {keys: ["inmedia"], defaultValue: "my_media_default_source"}; var deepLinkValue = {keys: ["dp_dest"], defaultValue: "peaches"}; // Setting OneLink custom parameter var deep_link_sub1 = {paramKey: "deep_link_sub1", keys: ["pageid"], defaultValue: "1a1a"}; var dl_product_id = {paramKey: "dl_product_id", keys: ["productid"], overrideValues: {shirt12: "men_shirt_012"}, defaultValue: "no_shirt"}; // This custom value is forced var dl_product_source = {paramKey: "dl_product_source", keys: [], defaultValue: "dl_new_source"}; //Function is embedded on the window object in a global parameter called window.AF_SMART_SCRIPT. //Onelink URL is generated var result = window.AF_SMART_SCRIPT.generateOneLinkURL({ oneLinkURL, afParameters:{ mediaSource: mediaSource, deepLinkValue: deepLinkValue, afCustom: [ deep_link_sub1, dl_product_id, dl_product_source ] } }) var result_url = "No output from script" if (result) { result_url = result.clickURL; document.getElementById('andrd_link').setAttribute('href', result_url); document.getElementById('ios_link').setAttribute('href', result_url); } document.getElementById('output_url').innerHTML = result_url;