Flow diagram
Implementation guidelines
Fire an impression
The impression is created using the Smart Script.
In order to create an impression the Smart Script requires a OneLink
template, with cross-platform attribution enabled.
Firing an impression includes the following steps:
-
Initializing the Smart Script arguments. These arguments will
carry the impression data, e.g.
media_source
,
campaign
, ad_name
etc.
The argument values are retrieved from the incoming URL query
parameters (e.g. UTM parameters) or default values.
Information regarding more Smart Script arguments can be found
here.
-
Call the Smart Script method
generateOneLinkURL
. The
method generates the infrastructure to fire an impression in the
next step.
Information regarding this method can be found
here.
Note: It is mandatory to add the
af_xplatform
parameter to afCustom
in
the afParameters
object in order to enable
cross-platform attribution:
var afParameters =
{
...
afCustom: [
{ paramKey: "af_xplatform", keys: [], defaultValue: "true" },
],
};
-
Fire an impression - verify the method
generateOneLinkURL
was
successful and call the method fireImpressionsLink
to fire the
impression.
var OL_result = window.AF_SMART_SCRIPT.generateOneLinkURL({
oneLinkURL,
afParameters: afParameters,
});
// Verify that the returned result from generateOneLinkURL() is not null.
// If verified, fire the impression.
if (OL_result) {
// The following command will fire the impression.
// The impression will fire to https://impressions.onelink.me//....
// The wait is a temporary bug fix
setTimeout(() => {
window.AF_SMART_SCRIPT.fireImpressionsLink();
console.log("Impression fired");
}, 1000);
}
Create installation links
In this section we will create platform-specific installation links,
the link will route the user to the relevant store (e.g. Steam
store).
For each redirection button in the page we will run the Smart-Script
method generateDirectClickURL
. If generation is
successful, the created link will be placed as the link behind the
button.
The method generateDirectClickURL
accepts the following
arguments:
-
afParameters
: these are the same attribution
parameters we've collected to send with the impression in the
previous section. The af_xplatform
is removed since
it is no longer required.
-
platform
: The platform this link aims for, e.g.
steam, epic, playstation etc.
app_id
: The application ID in this platform
-
redirectURL
: The URL the user will be redirected in
order to install the game, e.g. the link in the steam store
Platform specific links created on this page:
steam -> https://engagements.appsflyer.com/v1.0/c2s/click/app/steam/1234561?af_js_web=true&af_ss_ver=2_9_3&af_media_source=game_media_source&af_campaign=game_landing_page&af_campaign_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fstore.steampowered.com%2Fapp%2F1176160%2FSpace_Wars%2F
nativepc -> https://engagements.appsflyer.com/v1.0/c2s/click/app/nativepc/12341234?af_js_web=true&af_ss_ver=2_9_3&af_media_source=game_media_source&af_campaign=game_landing_page&af_campaign_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fgithub.com%2FAppsFlyerSDK%2Fappsflyer-unity-sample-app
epic -> https://engagements.appsflyer.com/v1.0/c2s/click/app/epic/butterflyer?af_js_web=true&af_ss_ver=2_9_3&af_media_source=game_media_source&af_campaign=game_landing_page&af_campaign_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fstore.epicgames.com%2Fen-US%2F
quest -> https://engagements.appsflyer.com/v1.0/c2s/click/app/quest/questtest?af_js_web=true&af_ss_ver=2_9_3&af_media_source=game_media_source&af_campaign=game_landing_page&af_campaign_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fwww.oculus.com%2Fexperiences%2Fquest%2F
nintendo_switch -> https://engagements.appsflyer.com/v1.0/c2s/click/app/switch/12345123451234?af_js_web=true&af_ss_ver=2_9_3&af_media_source=game_media_source&af_campaign=game_landing_page&af_campaign_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fwww.nintendo.com%2Fstore%2F
xbox -> https://engagements.appsflyer.com/v1.0/c2s/click/app/xbox/x1b2o3x4t5e6?af_js_web=true&af_ss_ver=2_9_3&af_media_source=game_media_source&af_campaign=game_landing_page&af_campaign_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fwww.xbox.com%2Fen-US%2Fmicrosoft-store
playstation -> https://engagements.appsflyer.com/v1.0/c2s/click/app/playstation/psn-test?af_js_web=true&af_ss_ver=2_9_3&af_media_source=game_media_source&af_campaign=game_landing_page&af_campaign_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fstore.playstation.com%2Fen-il%2Fpages%2Flatest
android -> https://app.appsflyer.com/com.appsflyer.onelinksimulator?af_js_web=true&af_ss_ver=2_9_3&pid=game_media_source&c=game_landing_page&af_c_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.appsflyer.onelinksimulator%26hl%3Den%26gl%3DUS
ios -> https://app.appsflyer.com/id1550796743?af_js_web=true&af_ss_ver=2_9_3&pid=game_media_source&c=game_landing_page&af_c_id=game_landing_page&af_ad=game_ad_name&af_adset=game_adset_name&af_r=https%3A%2F%2Fapps.apple.com%2Fus%2Fapp%2Fonelink-simulator%2Fid1550796743