Skip to main content
Custom Segments Guide
M
Written by Mike Quinn
Updated over a year ago

Developer

Setting the attribute name

When calling the showSurveyWall or displayEvent public SDK function, you'll need to set what custom attribute the player has. We only support ONE player_attribute per player at a time.

For this example, the player_attribute name is super-vip. The name of this attribute MUST match the Naming and setting the user attribute name from the Business user section. You can change this super-vip value to something that makes sense for your business.

You can change this attribute value at any time and re-call the TapResearch SDK showSurveyWall or displayEvent function. A use case for this would be when a user goes from a "regular vip" to a "super vip" and you want to have them hit a different placement.

When you are sending a user into a placement via identifier, you can use the same identifier for both vip and non-vip users. Because of the custom attribute set, TapResearch will ignore the placement you fetch and instead select the placement based on the custom attribute. You should not manually map a VIP placement to a VIP user as this will happen automatically. You should ignore the special placements when they are returned via SDK initialization.

Implementation

NOTE: The use of super-vip throughout this document is an example that matches the placement name. Please use a player_attribute that works for your organization.

iOS

You will need to create a TRPlacementCustomParameter object and set the key of player_attribute with a value (name) that matches the placement name set in the Supply Dashboard under the Gear icon (Settings).

TRPlacementCustomParameter *param = [TRPlacementCustomParameter new];
[[[[param builder] key: @"player_attribute"] value: @"super-vip"] build];
TRPlacementCustomParameterList *parameterList = [[TRPlacementCustomParameterList alloc] init];
[parameterList addParameter:param];
...
- (void)showSurveyWallWithDelegate:(id<TapResearchSurveyDelegate>)surveyDelegate
customParameters:(TRPlacementCustomParameterList *)parameterList;

Android

PlacementParameter parameter = new PlacementParameter.Builder().key("player_attribute").value("super-vip").build();
PlacementCustomParameters parameters = new PlacementCustomParameters();
parameters.addParameter(parameter)
mPlacement.showSurveyWall(SurveyListener listener, PlacementCustomParameters customParameters);

JS

When using the JS SDK, you’ll need to base64 encode your own message by taking the parameter string and sending it to a base64 encoder.

has_survey_callback: function(data) {
console.log("Has survey callback", data);
let customAttributes = { "player_attribute": "super-vip" };
let encodedCustomAttributes = btoa(JSON.stringify(customAttributes));
let uri = data.offer_url + '&pass_through_values=' + encodedCustomAttributes;
...
}

This will allow us to find the offer associated to a player attribute. If there is no match, then the offer in the initial request will be used.

You should be able to embed the survey wall by using an HTML object tag. An example: Take the output of the encode and append it to the offer URL that is received from the SDK:

$('.survey-link').attr('href', data.offer_url + '&pass_through_values=' + 'cGxhdGVyX2F0dHJpYnV0ZT1zdXBlci12aXA=');

Unity

TODO: Create this once the Unity SDK is updated to support custom attributes

React

TODO: Create this once the Unity SDK is updated to support custom attributes

Postback server-to-server response

This feature is only available for server-to-server clients.

The postback body will look like this and include the custom attributes you set as the pass_through_values

{
"tid": "aacc16a796b57d98b1f6bffdf9ed9c5f17838004",
"api_token": "your-api-token",
"cpid": "tap_pr_2286906822c108e6ada9e2286ec11903",
"revenue": 0,
"payout_amount": 100,
"payout_currency": "Little Hippos",
"uid": "test-user-safari-1-p",
"payout_type": 0,
"offer_identifier": "44a5d83c5540ecad2beb87522962e554",
"ip_address": "107.115.5.113",
"player_attribute": "super-vip",
"sech": "85ee062f3b69100943960c9c7fad410d"
}

Business user

Naming and setting the user attribute

The attribute name selected will be delineated by a *. The name can be anything you want prior to the * and MUST match the custom attribute after the *.

Example:

Placement name: Placement test 1 *super-vip.

There should not be a space between the * and the rest of the attribute name.

Placement test 1 * super-vip ← Do not do this.

is not the same as

Placement test 1 *super-vip ← You SHOULD do this.

The characters after the * should not have a space in them. Use -'s instead.

placements-ui-custom-attributes

Placement images

Contact our sales team to have them associate custom imagery with any placement(s).

In a future release, we will allow you to upload your own images.

Currency sales

For currency sales to behave correctly, there will need to be one used for VIPs and another used for everyone else.

currency-sales-custom-attributes

Did this answer your question?