Web SDK Options

The SDK supports the setting of options for better ad targeting.

The options explained here are not supported if you chose the automatic drop-in integration.

Check out our example project

You can find an example integration within the example project's 'vanillajs' directory.

User Targeting Options

You can specify additional information about the current user. The data is sent along ad requests to achieve better ad targeting. It can also be used to link Custom Events to a specific user.

Integration

// set the user's id
feedad.customParameters.userId("your user's id");

// set the user's gender
feedad.customParameters.userGender("f");

// set the user's age
feedad.customParameters.userAge(42);

// unset a value
feedad.customParameters.userAge(null);

The parameters can be set at any time after the SDK has been initialized.

User Config Parameters

Name Description
userAge the age of the current user in years
userId the ID of the current user
userGender the gender of the current user (either "m" for male or "f" for female)

Placement Targeting Options

You can also specify arbitrary key-value pairs for any placement on your website. Those can be either set for all placements or for specific placement ids.

Integration

// this would send your user group along all ad requests
feedad.customParameters.global("user group", "admin");
// this would add a second key value-pair
feedad.customParameters.global("user country", "GER");

// this would send the key value pair {"search-query": "cat videos"} along any ad request of the placement 'search-results'
feedad.customParameters.forPlacementId("search-results", "search-query", "cat videos");

// null deletes set values
feedad.customParameters.forPlacementId("search-results", "search-query", null);

Placement Config Parameters

Name Description
global (key, value)
Add key value pair for all future ad requests.
forPlacementId (placementId, key, value)
Add key value pair for all future ad requests of the placement with the id of the value of placementId.

Hybrid App Config

If you want to include the SDK as a component of an HTML5 hybrid app, you must set the following options when initializing FeedAd.

Integration

feedad.init("your-client-token", {
    hybrid_app: true,
    hybrid_platform: "android", // "ios", "windows"
    bundle_id: "the bundle id or package name of your app",
    app_name: "The name of your App",
    advertising_id: "the ad id of your app user" //optional, but recommended
});

Hybrid App Config Parameters

Name Description
hybrid_app Boolean indicating that the SDK is loaded within a hybrid app.
hybrid_platform String identifying the device platform. Either android, ios or windows.
bundle_id The unique package name or bundle id of your app.
app_name The name of your app. This name will identify your app within the FeedAd admin dashboard.
advertising_id (optional) The advertising id of the device or user. We highly recommend setting this parameter to maximize your fill rate.
(e.g. Apple IDFA, Google Advertising Client Id)

You should also read about the Ad Request Options to learn how to receive ads based on the device's connectivity.