OneLink Smart Script V2—Web-to-app URL generator
요약: 자동으로 생성되고 브랜드 웹 사이트의 단추 또는 배너 뒤에 임베드되는 원링크를 사용자 정의합니다.
원링크 스마트 스크립트 소개
사용자는 앱 스토어 페이지에 도달하기 전 또는 광고 캠페인을 통해 모바일 웹 사이트에 도착합니다. 그러나 두 번의 클릭이 있기 때문에 (첫 번째는 웹사이트에 디렉션하고 두 번째는 웹 페이지에서 앱스토어로 디렉션) 클릭 전환 메트릭과 딥링킹을 수집하는 것은 문제가 됩니다.
원링크 스마트 스크립트는 이러한 문제를 해결합니다. 스크립트는 다음을 수행합니다.
- 웹 페이지로 연결되는 수신 URL을 사용하여 앱 스토어로 연결되는 고유한 발신 원링크 URL을 자동으로 생성합니다.
- 모든 미디어소스에 대해 정확한 웹-투-애플리케이션 메트릭 모음을 제공합니다.
- 딥러닝에 사용할 수 있습니다.
- 웹 페이지 또는 랜딩 페이지에서 원활하게 실행됩니다.
The outgoing URLs are generated using the arguments you receive from the marketer and input into the script. Note: The afParameters
argument has a structure made up of several other arguments (parameters), each of which contains a configuration object that has keys, override values, and a default value. The arguments and configuration object structure are described in the sections that follow.
Configuration object
OneLink Smart Script는 인수를 사용하여 수신 URL의 파라미터와 스크립트에 정의된 인수를 기반으로 송신 URL을 생성합니다. afParameters 인수에는 어트리뷰션 및 딥링크에 사용되는 다른 여러 인수(파라미터)로 구성된 구조가 있으며, 각 인수에는 다음 표에 설명된 대로 키, 재정의 값 및 기본값이 있는 설정 개체가 포함됩니다.
인수 | 설명 | 예 |
---|---|---|
keys |
|
|
overrideValues |
|
Example: {'video': 'video_new'} 스크립트의 채널 파라미터의 경우, 수신 값이 비디오일 때마다 스크립트는 송신 링크에서 video_new로 변경합니다. |
defaultValue |
|
예: ['web_video'] 스크립트에서 채널 파라미터의 경우 in_channel 파라미터를 찾을 수 없으면 web_video가 채널 값으로 사용됩니다. |
Arguments
인수 | 설명 | 예 | |
---|---|---|---|
원링크 URL(필수) |
|
|
|
afParameters (필수)
|
mediaSource (필수) |
Configuration object for media source |
|
campaign |
Configuration object for campaign |
|
|
channel |
Configuration object for channel |
|
|
ad |
Configuration object for ad |
|
|
adSet |
Configuration object for adset |
|
|
deepLinkValue |
Configuration object for |
|
|
afSub1-5 |
Configuration object for |
||
googleClickIdKey |
GCLID를 전달하는 파라미터를 호출할 내용을 설명합니다. |
||
Other (custom) query parameters |
|
|
|
referrerSkipList |
List of the strings in the HTTP referrer for a particular click (for example Twitter or Facebook) that if found, cause the Smart Script to return null . This can be useful for SRNs like Twitter and Facebook, for which clicks are already reported.
|
||
urlSkipList |
List of the strings in the URL for a particular click (for example af_r ) that if found, cause the Smart Script to return null . This can be useful if you use an AppsFlyer attribution link with af_r to redirect users to your mobile website, and don't want data from the original click to be lost.
|
절차
Smart Script를 설정하려면 다음 중 하나를 수행하십시오.
- 웹사이트에 스크립트를 내장합니다.
- Google Tag Manager를 사용합니다.
Embed the script in your website
To embed the script to your website:
- Download the script and import it into the mobile site/pages on which you want it to run.
- Get from the marketer: The arguments to call the script which maps the incoming parameters to the outgoing parameters.
- Initialize the Smart Script arguments and configuration objects.
- Generate the URLs by calling the script in the web/landing page HTML using the following method:
var result = window.AF_SMART_SCRIPT.generateOneLinkURL({
oneLinkURL,
afParameters,
referrerSkipList // optional
})
Possible return values are:
- An outgoing Onelink URL.
- null
. If the script returns null
, implement your desired flow. For example: the web/landing page's existing URL is not changed.
Use Google Tag Manager
To set up the Smart Script in Google Tag Manager:
- Confirm that the marketer has the OneLink Smart Script code, followed by the Smart Script initialization code (with the arguments and configuration objects).
- Make sure the initialization code has a result passed to AF_SMART_SCRIPT_RESULT that is not null.
- Use the result value as needed. For example, to place it as a link under a CTA on your website.
Create a QR code with the Smart Script result
Prerequisite: Smart Script V2.1+
To create a QR code:
- Create a div tag with a specific ID in your site's HTML page to host the QR code.
You can style the div tag however you want. - After you run the Smart Script and generate a OneLink URL, call the following function and pass it the div ID:
window.AF_SMART_SCRIPT.displayQrCode("my_qr_code_div_id");
- Best practice: Once you have the result, show the QR code when users are on desktop and show the button with the link when users are on mobile.
예시
Basic attribution
The following example shows the basic conversion of an incoming URL to an outgoing OneLink URL, with a single key for media_source and campaign
Incoming URL:
https://appsflyersdk.github.io/appsflyer-onelink-smart-script/examples/single_key.html?incmp=gogo&inmedia=email
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
var campaign = {keys: ["incmp"]};
//Call the function after embedding the code through a global parameter on the window object called window.AF_SMART_SCRIPT.
//Onelink URL is generated
var result = window.AF_SMART_SCRIPT.generateOneLinkURL({
oneLinkURL: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
campaign: campaign,
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?pid=email&c=gogo&af_js_web=true&af_ss_ver=2_1_0
Multiple keys
The following example shows the conversion of an incoming URL to an outgoing OneLink URL, with multiple keys for media_source and campaign.
Incoming URL:
https://appsflyersdk.github.io/appsflyer-onelink-smart-script/examples/single_key.html?incmp11=gogo11&inmedia22=email22
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia11", "inmedia22"]};
var campaign = {keys: ["incmp11", "incmp22"]};
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
campaign: campaign,
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?af_js_web=true&af_ss_ver=2_1_0&pid=email22&c=gogo11
UTM parameters
The following example shows the conversion of an incoming URL to an outgoing OneLink URL, with UTM parameters for media_source and campaign.
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia","utm_source"]};
var campaign = {keys: ["incmp", "utm_campaign"]};
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
campaign: campaign,
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?pid=mysource&c=mycmpn&af_js_web=true&af_ss_ver=2_1_0
Override values
The following example shows the conversion of an incoming URL to an outgoing OneLink URL, replacing the incoming media_source value.
Incoming URL:
https://appsflyersdk.github.io/appsflyer-onelink-smart-script/examples/override_mediasource.html?inmedia=old_value
스크립트는 다음과 같습니다.
/Initializing Smart Script arguments
var oneLinkURL = “https://engmntqa.onelink.me/LtRd/”;
var mediaSource = {keys: [“inmedia”], overrideValues: {old_value: “new_value”}};
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?pid=new_value&af_js_web=true&af_ss_ver=2_1_0
Default values
The following example shows the conversion of an incoming URL to an outgoing OneLink URL, using the default value when an incoming media_source value isn't found.
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["not_there_inmedia"], overrideValues: {old_value: "new_value"}, defaultValue: "my_media_default_value"};
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?pid=my_media_default_value&af_js_web=true&af_ss_ver=2_1_0
Forced default values
The following example shows the conversion of an incoming URL to an outgoing OneLink URL, using the default value even when an incoming media_source value is found.
스크립트는 다음과 같습니다.
//Getting the dynamic value from anywhere
var some_dynamic_value = "my_media_value"
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: [], defaultValue: some_dynamic_value};
var campaign = {keys: [], defaultValue: "my_campaign"};
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
campaign: campaign
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?pid=my_media_value&c=my_campaign&af_js_web=true&af_ss_ver=2_1_0
Google click ID passthrough to af_sub
The following example shows the conversion of an incoming URL to an outgoing OneLink URL that passes the Google click ID to af_sub4. Note: When a GCLID is found, the script looks for the incoming parameter keyword, and puts the keyword value in the outgoing URL as the value of af_keywords.
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
var googleClickIdKey = "af_sub4";
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
googleClickIdKey: googleClickIdKey
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?af_js_web=true&af_ss_ver=2_1_0&pid=email&af_sub4=1a2b3c&af_keywords=sale+boat
Facebook click ID passthrough to af_sub
The following example shows the conversion of an incoming URL to an outgoing OneLink URL that passes the Facebook click ID to af_sub2.
Incoming URL:
https://appsflyersdk.github.io/appsflyer-onelink-smart-script/examples/facebook_clickid.html?inmedia=email&fbclid=7hjy89
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
// Facebook clickid is placed in af_sub2
var afSub2 = {keys: ["fbclid"], defaultValue: "no_fbclid"};
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
afSub2: afSub2
}
})
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?af_js_web=true&af_ss_ver=2_1_0&pid=email&af_sub2=7hjy89
Set attribution and OneLink parameters
The following example shows the conversion of an incoming URL to an outgoing OneLink URL with AppsFlyer attribution and OneLink parameters.
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
var channel = {keys: ["inchnl"]};
var deepLinkValue = {keys: ["dp_dest"], defaultValue: "peaches"};
var afSub3 = {keys: ["promo"]};
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
channel: channel,
deepLinkValue: deepLinkValue,
afSub3: afSub3
}
})
Set additional custom parameters
The following example shows the conversion of an incoming URL to an outgoing OneLink URL with additional custom parameters (including the af_prt parameter for agencies).
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
var deepLinkValue = {keys: ["dp_dest"], defaultValue: "peaches"};
// Setting an attribution parameter
var custom1 = {paramKey: "af_prt", keys: ["partner"], defaultValue: "defaultPartner"};
// Setting OneLink custom parameter
var custom2 = {paramKey: "dl_page_id", keys: ["pageid"], defaultValue: "1a1a"};
var custom3 = {paramKey: "dl_product_id", keys: ["productid"], overrideValues: {shirt12: "men_shirt_012"}, defaultValue: "no_shirt"};
// This custom value is forced
var custom4 = {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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
deepLinkValue: deepLinkValue,
afCustom: [
custom1,
custom2,
custom3,
custom4
]
}
})
Referrer skip list
You can disable the Smart Script for a particular click (for example, from Twitter or Facebook) by creating a skip list. If any of the strings in the skip list appear in the HTTP referrer of the click, the Smart Script returns null
.
Incoming URL:
https://appsflyersdk.github.io/appsflyer-onelink-smart-script/examples/referrer_skip_list.html?incmp=gogo&inmedia=email
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
var campaign = {keys: ["incmp"]};
var referrerSkipList = ["facebook"];
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
campaign: campaign,
},
referrerSkipList: referrerSkipList
})
Outgoing URL:
No output from script.
URL skip list
You can disable the Smart Script for a particular string in the URL (for example, af_r
) by creating a skip list. If any of the strings in the skip list appear in the URL of the click, the Smart Script returns null
.
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
var campaign = {keys: ["incmp"]};
var urlSkipList = ["af_r"];
//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: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
campaign: campaign,
},
urlSkipList: urlSkipList
})
Outgoing URL:
No output from script.
Smart Script set up with Google Tag Manager
The following example shows the conversion of an incoming URL to an outgoing OneLink URL using OneLink Smart Script set up using Google Tag Manager.
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["my_source"], defaultValue: "noMediaSource"};
var deepLinkValue = {keys: ["app_dest"], defaultValue: "default_view"};
// Setting an attribution parameter
var afSub4 = {keys: ["msg_id"], defaultValue: "no_msg_id"};
// Setting OneLink custom parameter
var deepLinkSub1 = {paramKey: "deep_link_sub1", keys: ["typeid"], defaultValue: "1a1a"};
//Function is embedded on the window object in a global parameter called window.AF_SMART_SCRIPT.
//Onelink URL is generated
AF_SMART_SCRIPT_RESULT = window.AF_SMART_SCRIPT.generateOneLinkURL({
oneLinkURL: oneLinkURL,
afParameters:{
mediaSource: mediaSource,
deepLinkValue: deepLinkValue,
afSub4: afSub4,
afCustom: [
deepLinkSub1
]
}
})
QR code
Incoming URL:
https://appsflyersdk.github.io/appsflyer-onelink-smart-script/examples/qr_code.html?inmedia=my_email&incmp=my_campaign
스크립트는 다음과 같습니다.
//Initializing Smart Script arguments
var oneLinkURL = "https://engmntqa.onelink.me/LtRd/";
var mediaSource = {keys: ["inmedia"]};
var campaign = {keys: ["incmp"]};
//Call the function after embedding the code through a global parameter on the window object called window.AF_SMART_SCRIPT
//Onelink URL is generated
var result = window.AF_SMART_SCRIPT.generateOneLinkURL({
oneLinkURL,
afParameters:{
mediaSource: mediaSource,
campaign: campaign,
}
})
var result_url = result.clickURL;
if (result_url) {
document.getElementById('output_url').innerHTML = result_url;
window.AF_SMART_SCRIPT.displayQrCode("my_qr_code_div_id");
}
Outgoing URL:
https://engmntqa.onelink.me/LtRd/?af_js_web=true&af_ss_ver=2_1_0&pid=my_email&c=my_campaign
나가는 QR 코드:
최신 데이터 about 1 month ago