Skip to content

Commit

Permalink
GCLID and FBCLID passthrough to custom params
Browse files Browse the repository at this point in the history
  • Loading branch information
liaz-af committed Jan 25, 2024
1 parent 340d881 commit baead73
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 8 additions & 3 deletions examples/facebook_clickid.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- This example will demonstare converting a URL to OneLink URL using Facebook click id -->
<!-- Calling URL: https://appsflyersdk.github.io/af-onelink-smart-script/examples/facebook_clickid.html?inmedia=email&fbclid=7hjy89 -->
<!-- Expected OneLink URL: https://engmntqa.onelink.me/LtRd/?af_js_web=true&af_ss_ver=2_2_0&pid=email&af_sub2=7hjy89 -->
<!-- Expected OneLink URL: https://engmntqa.onelink.me/LtRd/?af_js_web=true&af_ss_ver=2_2_0&pid=email&af_sub2=7hjy89&fbclid=7hjy89 -->
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -58,16 +58,21 @@ <h3>To edit: make changes to the input URL in the address bar and reload the pag
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"};
// Facebook clickid is placed in af_sub2
// Facebook clickid passthrough to af_sub2 outgoing parameter
var afSub2 = {keys: ["fbclid"]};
// Facebook clickid passthrough to "fbclid" outgoing parameter
var fbclid_out = {paramKey: "fbclid", keys: ["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,
afParameters:{
mediaSource: mediaSource,
afSub2: afSub2
afSub2: afSub2,
afCustom: [
fbclid_out
]
}
})

Expand Down
7 changes: 6 additions & 1 deletion examples/google_clickid.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ <h3>To edit: make changes to the input URL in the address bar and reload the pag
// 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 googleClickIdKey = "af_sub4";
// Facebook clickid passthrough to "fbclid" outgoing parameter
var gclid_out = {paramKey: "gclid", keys: ["gclid"]};

//Calling the function after embedding the code will be through a global parameter
//on the window object called window.AF_SMART_SCRIPT
Expand All @@ -68,7 +70,10 @@ <h3>To edit: make changes to the input URL in the address bar and reload the pag
oneLinkURL,
afParameters:{
mediaSource: mediaSource,
googleClickIdKey: googleClickIdKey
googleClickIdKey: googleClickIdKey,
afCustom: [
gclid_out
]
}
})

Expand Down

0 comments on commit baead73

Please sign in to comment.