OneLinkUrlGenerator v1

Overview

The OneLinkUrlGenerator automatically generates and embeds links behind a button or banner on your brand's website.

Public Constructors

OneLinkUrlGenerator

Input arguments

TypeParameterDescription
StringoneLinkURL [required]- Serves as the base for all links generated by the script.
- It is the OneLink template domain + template ID.
List of stringspidKeysList- Lists the media source parameter/s in the incoming URL that will be placed as the pid parameter in the outgoing URL.
- If there are multiple media source params in the incoming link (for example af_pid and utm_source), the pidKeysList scans the params from first to last, and uses the first match found.
dictionary {string: string,
…}
pidOverrideListLists the media source values in the incoming URL, alongside what you them to be replaced with.
StringpidStaticValueIf a pid key is not found in the pidKeysList, the pidStaticValue is used as the pid value.
List of stringscampaignKeysListLists the campaign parameter/s in the incoming URL that will be placed as the c parameter in the outgoing URL.
StringcampaignStaticValueIf a campaign key is not found in the campaignKeysList, the campaignStaticValue is used as the c value.
StringgclIdParam- Defines which parameter in the outgoing URL carries the GCLID.
- Any parameter can be chosen. Note! To display in AppsFlyer raw data reports, the param must be one of af_sub[1-5].
StringskipListIf any strings in the skip list appear in the HTTP referrer, the Smart Script does not run and returns null.

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         pidStaticValue: 'my_static_pid',
         campaignKeysList: ['incoming_campaign'],
         campaignStaticValue: 'my_static_cmpn',
      });

Public Methods

generateUrl

Overview

This function generates the URL based on the public constructors described above, and the setter functions described below.

Input arguments

None

Return value

TypeDescription
StringURL generated by OneLinkUrlGenerator

Usage example

const url = onelinkGenerator.generateUrl();

setDeepLinkValue

Input arguments

TypeParameterDescriptionRequired
StringdeepLinkValueParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL deep_link_value.True
StringdeepLinkValueA fallback value to be set in the outgoing URL deep_link_value if deepLinkValueParam is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });
onelinkGenerator.setDeepLinkValue("original_url_deeplinkvalue", "yessss");
const url = onelinkGenerator.generateUrl();

setChannel

Input arguments

TypeParameterDescriptionRequired
StringchannelParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_channel.True
StringchannelValueA fallback value to be set in the outgoing URL af_channel if channelParam is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });
onelinkGenerator.setChannel("original_url_channel", "new_channel");
const url = onelinkGenerator.generateUrl();

setAdset

Input arguments

TypeParameterDescriptionRequired
StringadsetParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_adset.True
StringadsetValueA fallback value to be set in the outgoing URL af_adset if adsetParam is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });

onelinkGenerator.setAdset("no_adset", "adset");
const url = onelinkGenerator.generateUrl();

setAd

Input arguments

TypeParameterDescriptionRequired
StringadParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_ad.True
StringadValueA fallback value to be set in the outgoing URL af_ad if adParam is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });

onelinkGenerator.setAd("original_url_ad", "new_ad");
const url = onelinkGenerator.generateUrl();

setAfSub1

Input arguments

TypeParameterDescriptionRequired
StringafSub1ParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub1.True
StringafSub1ValueA fallback value to be set in the outgoing URL af_sub1 if afSub1Param is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });

onelinkGenerator.setAfSub1("original_url_sub1", "ram_afsub1");
const url = onelinkGenerator.generateUrl();

setAfSub2

Input arguments

TypeParameterDescriptionRequired
StringafSub2ParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub2.True
StringafSub2ValueA fallback value to be set in the outgoing URL af_sub2 if afSub2Param is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });

onelinkGenerator.setAfSub2("original_url_sub2","fallback_sub2");
const url = onelinkGenerator.generateUrl();

setAfSub3

Input arguments

TypeParameterDescriptionRequired
StringafSub3ParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub3.True
StringafSub3ValueA fallback value to be set in the outgoing URL af_sub3 if afSub3Param is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });

onelinkGenerator.setAfSub3("original_sub3", "new_afsub3");
const url = onelinkGenerator.generateUrl();

setAfSub4

Input arguments

TypeParameterDecsriptionRequired
StringafSub4ParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub4.True
StringafSub4ValueA fallback value to be set in the outgoing URL af_sub4 if afSub4Param is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });
onelinkGenerator.setAfSub3("orignial_sub4", "fallback_afsub4");
const url = onelinkGenerator.generateUrl();

setAfSub5

Input arguments

TypeParameterDecsriptionRequired
StringafSub5ParamThe key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub5.True
StringafSub5ValueA fallback value to be set in the outgoing URL af_sub5 if afSub5Param is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });
onelinkGenerator.setAfSub5("neverfind_sub5", "new_afsub5");
const url = onelinkGenerator.generateUrl();

setCustomParameter

Input arguments

TypeParameterDecsriptionRequired
StringsearchKeyThe key in the incoming URL from which the script takes the value to set in the outgoing URL customKeyTrue
StringcustomKeyThe key in the outgoing OneLink URL in which to place the value found by searchKeyTrue
StringcustomValueA fallback value to be set in the outgoing URL customKey if searchKey is not found in the incoming URL.False

Return value

void

Usage example

const onelinkGenerator =  new window.AF.OneLinkUrlGenerator(
        {oneLinkURL: "https://engmntqa.onelink.me/LtRd/",
         pidKeysList: ['incoming_media_source'],
         campaignKeysList: ['incoming_campaign']
      });
onelinkGenerator.setCustomParameter("search_key_on_url", "onelink_custom_param", "fallback_value");
const url = onelinkGenerator.generateUrl();