Optimization and retargeting to in-app events
Optimizing and retargeting for in-app events lets you show smart banners to users that interact with your mobile app. For example, part of your audience visits an online store only from a smartphone and views more products in the app rather than on the site. Use in-app events to target smart banners at such users.
This feature is available in the “Text & Image ads”, “Smart banners”, and “Dynamic ads” campaigns.
Statistics on in-app conversions are available both in Yandex Direct and in the Mobile Measurement Platform (MMP).
Yandex Direct supports the most popular Mobile Measurement Platforms: AppMetrica, Adjust, and AppsFlyer.
- Use cases
-
- Optimize conversions on your site and in your apps within one campaign
-
Increase the number of conversions in your campaigns. By using the same campaign for onsite and in-app conversions, you decrease your average CPA and help your ad algorithms learn more efficiently and increase your reach faster.
- Retargeting for mobile app users
-
Expand your retargeted audience with those app users that demonstrate high conversion rates more often. Customize your audience segments: you can create campaigns targeted only at app users. You can also combine audiences from your site and from the app in one campaign.
- Conversion of site users to app users
-
Increase the effectiveness of your sales from Yandex Direct. App users demonstrate higher engagement and view more products. However, they visit sites from their computers also. You can use retargeting to lead site users to your app.
- Checklist for setting up campaigns with in-app events
-
- Set up your MMP to work with Yandex Direct.
- Set up an ad campaign based on the recommendations.
Adding an app to Yandex Direct
In the side menu, click Library and select Mobile apps. Click Add app.
Enter the link to the app in the AppStore or Google Play. Yandex Direct will upload the icon, price, rating, number of ratings and app specifications from the store.
Apps for different platforms (iOS and Android) are added separately.
Link the application in the Yandex Direct library with a relevant project in AppMetrica: in the App from AppMetrica field, select the name from the list.
If the relevant project name is missing from the list, go to AppMetrica and grant access to the application by following the instructions and specifying your Yandex Direct username.
Leave the Tracking link field empty.
Under Goals for the strategy, select the events to optimize for or to build a retargeting segment for.
Leave the Tracking link field empty.
Under Goals for the strategy, select the events to optimize for.
Save the app (it will appear in the list). You'll need the App ID column value for integrating with the MMP.
Leave the Tracking link field empty.
Under Goals for the strategy, select the events to optimize for.
Save the app (it will appear in the list). You'll need the App ID column value for integrating with the MMP.
- Access for other accounts
-
You can allow other accounts to access app goals added to the library. If you have a sophisticated account structure in Yandex Direct, share access to the app from the account that hosts “Ads for mobile apps” campaigns.
Open Grant access.
and clickIn the pop-up window, specify usernames who need to access the goals, then click Grant access.
The specified usernames will be granted access to the apps in your account library. You can use the goals specified for these apps in the campaign settings for the selected usernames.
Setting up an MMP
Setting up an MMP consists of 3 steps:
Setting up data collection in the mobile app
If you have already used retargeting based on in-app events in other ad networks, you can skip this step.
Checklist for setting up events in the MMP:- Make sure that the MMP collects events you want to optimize your campaigns for or make retargeting for.
- If you are going to launch smart banners and dynamic ads, make sure that you collect the following events: product page viewed, product added to cart, product removed from cart, and product purchased. The events include the IDs of your products.
For the Maximum conversions strategy limited by the cost-revenue ratio, make sure also to set a limit on revenue.
If you don't know how to check the event configuration, contact the app developer or your MMP support.
Data format for Text & Image Ads
All types of markup are supported: regular Events, ECommerce, and In-App purchases.
Data format for smart banners and dynamic ads
ECommerce events markup is required. It's available for Android versions higher than 3.16.1 on and iOS versions higher than 3.12.0.
The following events are enough for smart banners to work:
showProductDetailsEvent
addCartItemEvent
removeCartItemEvent
purchaseEvent
Make sure to pass an SKU (product ID) in the ECommerceProduct class of each event. The other parameters are needed to populate the Ecommerce report.
Tracking openings
To make sure that AppMetrica can attribute conversions after clicks on universal or tracking links, set up tracking openings by deeplink.
In SDK version 4.0 and higher, tracking is automatic.
Requirements for the “Target cost revenue ratio” strategy
For conversions in this strategy, you can use ECommerce events or In-App purchase markup.
Data format for Text & Image Ads
Rich In-App Events are supported.
Data format for smart banners and dynamic ads
The following Rich In-App Events are required:
- af_content_view: Product viewed.
- af_add_to_cart: Added to cart.
- remove_from_cart: Product removed from cart.
- af_purchase: Purchased.
Make sure to add the af_content_id
parameter used to pass the product ID to all the events.
For more information, see your MMP's documentation for implementing the event code.
Requirements for the “Target cost revenue ratio” strategy
You need to set up revenue collection in the af_revenue
parameter for in-app events. Instructions for developers:
Data format for Text & Image Ads
All Adjust events are supported.
Data format for smart banners and dynamic ads
The format supports events with Partner Parameters (available in the Adjust SDK version 4.0 or higher) that expect offer_id
, which can either be a Product ID or a list of products in JSON format.
AdjustEvent event = new AdjustEvent("VIEWED_CONTENT");
event.addPartnerParameter("offer_id", "10001");
Adjust.trackEvent(event);
AdjustEvent event = new AdjustEvent("PURCHASED");
event.addPartnerParameter("offer_id", "[\"1234\",\"5678\"]");
Adjust.trackEvent(event);
If a product ID is used in event parameters, but its name differs from offer_id, then you don't need to make any edits to your app: you can edit this value when setting up event transmission to Yandex Direct using Parameter Mapping.
Attribution using deeplink tracking
Adjust needs to support deeplink tracking so it can attribute conversions after clicking to an app. Instructions for developers:
Requirements for the “Target cost revenue ratio” strategy
You need to set up revenue collection in your in-app events. Instructions for developers:
Transmitting events
Configure Adjust according to the recommendations:
- In the Yandex Ecom Feed Counter ID field, specify the Yandex Metrica tag for the site.
- In the Event Linking section, configure event transmission:
- Product viewed:
Viewed content
. - Product added to cart:
Added to cart
. - Product removed from cart:
Removed from cart
. - Purchase:
Purchased
.
- Enable Parameter Forwarding.
- Enable In-App Revenue Forwarding.
If the parameter names in events deviate from requirements, map the parameters using Parameter Mapping
If a product ID is used in event parameters, but its name differs from offer_id
, set up mapping for the event transmission.
Setting up transmitting events
Set up transmitting in-app events from the MMP to Yandex Direct to use them in the Maximum conversions strategy or as retargeting criteria.
For Text & Image Ads
Events are transmitted automatically. You can use optimization and retargeting for goals.
For smart banners and dynamic ads
- In the app settings, in the Metrika tag binding field, specify the Yandex Metrica tag.
- The username must have access to the tag.
We recommend that you use the tag for the site where you have set up e-commerce: in this case, machine learning algorithms will include products viewed in the app for site users, and the other way round. This helps you increase the effectiveness of retargeting.
General setup rules
- Open the Integrated Partners section and select Yandex Direct.
- Go to the Integration tab.
- Enable Activate partner.
- In the Yandex App ID field, specify the App ID that you obtained when adding your mobile app to Yandex Direct.
- Enable In-app events postback to send events.
Select events and set up SDK Event Name > Partner Event Identifier mapping. Use the EVENT_1, EVENT_2, or EVENT_3 identifiers if none of the presets suits you.
- Select Sending option: All media sources, including organic and Send revenue: Values & revenue to transmit revenue and event parameters.
Requirements for smart banners and dynamic ads
In the Yandex Ecom Feed ID field, specify the Yandex Metrica tag in 12345 format.
We recommend that you use the tag for the site where you have set up e-commerce: in this case, machine learning algorithms will include products viewed in the app for site users, and the other way round. This helps you increase the effectiveness of retargeting.
Select the events:
af_content_view
>VIEWED_CONTENT
(required).af_added_to_cart
>ADDED_TO_CART
(required);remove_from_cart
>REMOVED_FROM_CART
(recommended).af_purchase
>PURCHASED
(required).
- Select Sending option: All media sources, including organic and Send revenue: Values & revenue to transmit revenue and event parameters.
Requirements for the “Target cost revenue ratio” strategy
Select Send revenue: Values & revenue to transmit the revenue.
General setup rules
- Go to the app settings and open Partner Setup.
- Select.
- In the Yandex App ID field, specify the App ID that you obtained when adding your mobile app to Yandex Direct.
- Enable In-App Revenue Forwarding, Parameter Forwarding, and Session Forwarding.
- Set up event transmission in Event Linking by selecting the appropriate name from the list. All settings are specified for iOS and Android separately.
Requirements for smart banners and dynamic ads
In the Yandex Ecom Feed ID field, specify the Yandex Metrica tag in 12345 format.
We recommend that you use the tag for the site where you have set up e-commerce: in this case, machine learning algorithms will include products viewed in the app for site users, and the other way round. This helps you increase the effectiveness of retargeting.
- In the Event Linking section, configure event transmission:
- Product viewed:
Viewed content
(required). - Product added to cart:
Added to cart
(required). - Product removed from cart:
Removed from cart
(recommended). - Purchased:
Purchased
(required).
If, in the event parameters, the Product ID isn't named
offer_id
, click Partner Parameter Mapping. In the FROM APP field, enter the parameter's name in the SDK, and in the TO PARTNER field, specify theoffer_id
.
Setting up app links
Use universal links that will lead users to the app if already installed, or to the site if it isn't: this lets you increase the conversion rate for your campaigns.
Universal links let you use the same feed for the site, in smart banners, and in dynamic ads.
General rules for links
The app link must be suitable for counting conversions, that is:
- Lead to the app if the app is installed.
- Lead to the site if the app is not installed or the link is clicked on a computer.
- Let the MMP attribute conversions to clicks.
Universal links have the format of a regular link (for example, avito.ru
) and are enabled on the site and in the app without the MMP's SDK. If the app is installed, paste the link to Telegram or Notes and click it. The app should open.
If the app is not installed, you can check whether universal links are installed by uploading the following file to your site and replacing example.ru
with your domain:
A page with text should open or a text file will be downloaded.
Instructions for different platforms:
If you can't or won't set up universal links for some reason, then you can use tracking links. They include the MMP's domain (for example, adj.st
, onelink.me
, redirect.appmetrica.com
), and they are created in the MMP.
Universal links
Add the referrer=reattribution%3D1
parameter to your campaigns.
In smart banners and dynamic ads, you can add the parameter at the ad group level without making changes to the feed.
Universal links
No other changes to the link are required. Clicks will be sent from Yandex Direct to AppsFlyer using the server-to-server tracking method.
Cross-server click sending is enabled when you set up a campaign in Yandex Direct. Start creating a campaign, select a goal for your mobile app. After that, a section will appear below on the page where you can enable sending clicks to your MMP.

Universal links
Add the following parameters to the universal link:
adjust_ya_click_id={logid}
adjust_campaign={campaign_name}
adjust_t=abc_def
: Enter the MMP's ID instead ofabc
for Android and instead ofdef
for iOS. Leave an underscore in the middle. If your app is multi-platform, specify a single MMP ID:adjust_t=abc
. You can use the theadjust_tracker
parameter instead ofadjust_t
.
Sample link:
https://example.ru/cars/new/group/bmw/3er/21398591-21398651?adjust_ya_click_id={logid}&adjust_t=abc_def&adjust_campaign={campaign_name}
Tracking links
We recommend using universal links. If you can't or won't set them up for some reason, then you can use tracking links.
Please keep in mind that in this case you need to update the feed in smart banners and dynamic ads. Make sure to replace links to products in it with tracking links.
- Check that the app supports Universal Links.
- Create a Smart Link in the interface (use the app-to-app link).
To set up UTM tags and other custom parameters, go to the Smart Link settings and follow the instructions.
Sample link:
https://0000000.redirect.appmetrica.yandex.com/cars/new/group/bmw/3er/21398591-21398651?appmetrica_tracking_id=00000000000000000&referrer=reattribution%3D1&click_id={LOGID}&campaign_id={campaign_id}&path=%2F%20cars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651
For more information, see Tracking links based on Universal Links.
Check the AppsFlyer Help to learn how to enable it.
Required parameters
pid=yandexdirect_int
clickid={logid}
is_retargeting=true
.
Optional parameters:
af_click_lookback
: The attribution window (between the click and opening the app). It's specified in days (for example, 14d). The default value (if you don't pass this parameter) is 7 days.af_reengagement_window
: The re-engagement window (between attribution and conversion). It's specified in days. The default value is 30 days.
To set up UTM tags and other custom parameters, go to the OneLink template settings.
Sample link:
https://example.onelink.me/AbcD?pid=yandexdirect_int&is_retargeting=true&clickid={logid}&c={campaign_name}&af_dp=autoru%3A%2F%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651%0A&af_web_dp=https%3A%2F%2Fauto.ru%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651%0A&af_ios_url=https%3A%2F%2Fauto.ru%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651%0A&af_android_url=https%3A%2F%2Fauto.ru%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651%0A
See also Tracking links based on Universal Links.
The Adjust documentation describes:
- How to set up Universal Links .
- How to create a tracking link.
Required parameters
- In the tracking link:
adj_ya_click_id={logid}
oradjust_ya_click_id={logid}
. - In the fallback URL inside the tracking link:
yclid={logid}
UTM tags are specified in the fallback URL.
Sample link:
https://sb00.adj.st/cars/new/group/bmw/3er/21398591-21398651?adjust_ya_click_id={logid}&adjust_t=abc_def&adjust_campaign={campaign_name}&adjust_deeplink=autoru%3A%2F%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651&adjust_redirect=https%3A%2F%2Fauto.ru%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651%3Fyclid%3D{logid}
See also Tracking links based on Universal Links.
- In the MMP settings, click the Reattribution tab.
Specify the indicators:
- Inactivity period: The time elapsed since the user last opened your app to qualify for attribution. This period is 7 days by default. Use 0 days to reattribute the last click.
- Reattribution window: The time period between the click and conversion, during which the conversion is attributed to the source. It's 7 days by default. For example, if a user clicked on a Yandex Direct ad on Monday and bought your product on Friday, the purchase is attributed to Yandex Direct.
Applies only to dynamic ads and smart banners.
Add a tracking link to the element including the product link. The link must redirect the user to a specific product (either on the site or in the app). For XML/YML feeds, follow the additional requirements.
Example of a tracking link in the feed:
<offer id="21398651" available="true">
<url>https://sb00.adj.st/cars/new/group/bmw/3er/21398591-21398651?adjust_ya_click_id={logid}
&adjust_t=abc_def&adjust_campaign={campaign_name}&adjust_deeplink=autoru%3A
%2F%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651&adjust_redirect= https%3A%
2F%2Fauto.ru%2Fcars%2Fnew%2Fgroup%2Fbmw%2F3er%2F21398591-21398651%3Fyclid%3D{logid}
</url>
...
</offer>
Re-attribution means re-engagement of an inactive user to the app or re-installation of the app as a result of retargeting. If this occurs during the re-attribution window, the re-attribution is counted for the retargeting source.
Configure re-attribution settings in the MMP if you use the mobile app goal in the strategy settings, that is, Optimize conversions or Target cost revenue ratio.
Retargeting attribution guide in the AppsFlyer documentation.
Go to
and enable retargeting attribution.Reattribution tracking section in the Adjust documentation.
Recommendations for setting up campaigns
Create a Text & Image Ads, Dynamic ads, or Smart banners campaign. In the campaign settings, specify:
If a campaign leads users both to the app and site, use strategies optimized for several goals. Add conversions for your site and app. Set the values for them.
If you transmit revenue for goals and optimize the cost revenue ratio, use the Maximum conversions strategy limited by the cost-revenue ratio and optimized for several goals. Select the “dynamic” value for goals.
If you use AppsFlyer and universal links, then after selecting a mobile goal in the strategy section, enable Automatically send clicks to AppsFlyer.
For AppMetrica and Adjust, specify the special parameters in the link. For smart banners and dynamic ads, you can specify them in the ad group settings.