OneLinkUrlGenerator

Overview

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

Public Constructors

OneLinkUrlGenerator

Input arguments

Type

Parameter

Description

String

oneLinkURL [required]

  • Serves as the base for all links generated by the script.
  • It is the OneLink template domain + template ID.

List of strings

pidKeysList

  • 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,
…}

pidOverrideList

Lists the media source values in the incoming URL, alongside what you them to be replaced with.

String

pidStaticValue

If a pid key is not found in the pidKeysList, the pidStaticValue is used as the pid value.

List of strings

campaignKeysList

Lists the campaign parameter/s in the incoming URL that will be placed as the c parameter in the outgoing URL.

String

campaignStaticValue

If a campaign key is not found in the campaignKeysList, the campaignStaticValue is used as the c value.

String

gclIdParam

  • 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].

String

skipList

If 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

Type

Description

String

URL generated by OneLinkUrlGenerator

Usage example

const url = onelinkGenerator.generateUrl();

setDeepLinkValue

Input arguments

Type

Parameter

Description

Required

String

deepLinkValueParam

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL deep_link_value.

True

String

deepLinkValue

A 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

Type

Parameter

Description

Required

String

channelParam

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_channel.

True

String

channelValue

A 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

Type

Parameter

Description

Required

String

adsetParam

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_adset.

True

String

adsetValue

A 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

Type

Parameter

Description

Required

String

adParam

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_ad.

True

String

adValue

A 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

Type

Parameter

Description

Required

String

afSub1Param

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub1.

True

String

afSub1Value

A 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

Type

Parameter

Description

Required

String

afSub2Param

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub2.

True

String

afSub2Value

A 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

Type

Parameter

Description

Required

String

afSub3Param

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub3.

True

String

afSub3Value

A 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

Type

Parameter

Decsription

Required

String

afSub4Param

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub4.

True

String

afSub4Value

A 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

Type

Parameter

Decsription

Required

String

afSub5Param

The key in the incoming URL from which the script takes the deep link value to set in the outgoing URL af_sub5.

True

String

afSub5Value

A 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

Type

Parameter

Decsription

Required

String

searchKey

The key in the incoming URL from which the script takes the value to set in the outgoing URL customKey

True

String

customKey

The key in the outgoing OneLink URL in which to place the value found by searchKey

True

String

customValue

A 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();

Did this page help you?