Data & keyword passing

Content URL passing

AppLovin recommends that you pass your app content URL when you make ad requests. It allows for buy-side contextualization or review. Some DSP buyers may require it. You pass this URL in the bid request.

You can pass your app content URL when you make an ad request. The following code snippets show how to do this:

Banner ad
bannerAd = new MaxAdView( "«ad-unit-ID»" );
bannerAd.setExtraParameter( "content_url", "«value»" );
Interstitial ad
interstitialAd = new MaxInterstitialAd( "«ad-unit-ID»" );
interstitialAd.setExtraParameter( "content_url", "«value»" );
MREC ad
mrecAd = new MaxAdView( "«ad-unit-ID»", MaxAdFormat.MREC );
mrecAd.setExtraParameter( "content_url", "«value»" );
Native ad
nativeAdLoader = new MaxNativeAdLoader( "«ad-unit-ID»" );
nativeAdLoader.setExtraParameter( "content_url", "«value»" );
Rewarded ad
rewardedAd = MaxRewardedAd.getInstance( "«ad-unit-ID»" );
rewardedAd.setExtraParameter( "content_url", "«value»" );

Unified identifiers

You can pass UID2 tokens in the bid stream. Buyers use these tokens to target and accurately bid on app inventory. You are responsible for tokenizing and for passing the token to AppLovin. The code examples below show how you pass the tokens:

AppLovinSdkSettings settings = AppLovinSdk.getInstance( context ).getSettings();
settings.setExtraParameter( "uid2_token", "«value»" );

Additional user identifiers

AppLovin recommends that you pass user email addresses, phone numbers, and Publisher User IDs for attribution and matching purposes.

The SDK automatically hashes email addresses and phone numbers with SHA-256 on the device, and sends the email domain in plaintext. It never transmits the plaintext email address or phone number. The SDK sends the Publisher User ID as you provide it, so do not include other personal or third-party identifiers in that field.

Before you pass additional user identifiers, make sure that you have all rights and permissions necessary to share it with AppLovin, including any end-user consent that applicable privacy laws require, and that your privacy policy discloses this sharing.

AppLovinUserData userData = new AppLovinUserData();
userData.setEmail( "user@example.com" );
userData.setPhone( "+12125550123" );
userData.setUserId( "your_user_id" );
AppLovinSdk.getInstance( this ).setUserData( userData );

Set every field that is available to you; each one is optional.

Note the following when you pass additional user identifiers:

  • Set the data as early as you can. Set these additional user identifiers as soon as the user signs in or otherwise provides their information and set it again on every subsequent app launch.
  • Pass a valid email address. The SDK ignores values that are not well-formed email addresses.
  • Pass the phone number in international format, including the + and country code (for example, +12125550123). The SDK hashes the digits you provide, so a number that omits the country code produces a hash that cannot be matched. The SDK ignores the value unless 8 to 15 digits remain.

AppLovin hashes plaintext email addresses and phone numbers that you provide.

If you would prefer to perform your own hashing, do so by carefully following these guidelines:
email
Remove any leading or trailing whitespace. Convert any uppercase characters to lowercase. Then hash via SHA256. Any email in wrong format should produce empty value.

For gmail.com and googlemail.com only, first remove all periods before the @, and remove the first plus sign and everything after it. Leave the domain unchanged. If nothing remains before the @, produce an empty value.

phone
Remove any leading or trailing whitespace. Also remove any leading zeros. Remove any dashes, plus-signs, or other symbols. Convert any letters to their numerical counterparts. Always include the country code (for example, 1 for United States phone numbers). Then hash via SHA256.

For example (for email addresses):

InputNormalizedSHA256
Alice@Example.COMalice@example.comff8d9819fc0e12bf0d24892e45987e249a28dce836a85cad60e28eaaa8c6d976
J..A.NE+work.more+extra@GMAIL.COMjane@gmail.com988b074286b20c503e3015c2076533f3bf4ce5ca6f8a507ab52c2e0f98d620b7
Jane.Doe+Work@GoogleMail.comjanedoe@googlemail.com338abf9ef1c8793cadc7bcf51ed595338eb727ed9e06ce3d91d566d60b975937

Reference implementations follow. Each one prints the hash for the second example above; run it and confirm you get the same value.

#include <algorithm>
#include <cctype>
#include <iostream>
#include <regex>
#include <string>

#include <openssl/sha.h>

std::string normalizeAndHash(std::string email)
{
    email.erase(0, email.find_first_not_of(" \t\n\r\f\v"));
    email.erase(email.find_last_not_of(" \t\n\r\f\v") + 1);
    std::transform(email.begin(), email.end(), email.begin(),
                   [](unsigned char c) { return std::tolower(c); });

    static const std::regex valid("^[!-?A-~]+@[!-?A-~]+$");
    if (!std::regex_match(email, valid))
        return "";

    const auto at = email.find('@');
    std::string local = email.substr(0, at);
    const std::string domain = email.substr(at + 1);
    if (domain == "gmail.com" || domain == "googlemail.com")
    {
        local = local.substr(0, local.find('+'));
        local.erase(std::remove(local.begin(), local.end(), '.'), local.end());
        if (local.empty())
            return "";
    }

    const std::string normalized = local + "@" + domain;
    unsigned char hash[SHA256_DIGEST_LENGTH];
    SHA256(reinterpret_cast<const unsigned char*>(normalized.data()),
           normalized.size(), hash);

    static constexpr char digits[] = "0123456789abcdef";
    std::string out;
    for (const unsigned char value : hash)
    {
        out += digits[value >> 4];
        out += digits[value & 15];
    }
    return out;
}

int main()
{
    std::cout << normalizeAndHash("  J..A.NE+work.more+extra@GMAIL.COM  ") << "\n";
}

search