Targeting Visitor Groups

We can target a campaign for specific users of the app.
To do this, under Advanced Options, select the Finalize step and then select Enable campaign for a specific user group.

1386

You can target the app according to the following options:

  • Phone Users
  • Tablet Users
  • New Users
  • Returning Users
  • App Version
  • Android Version
  • Day of Week
  • Hour of the Day
  • Country
  • Screen Width
  • Screen Height

Please note that all the above targeting options do not require any code changes.

If you want to do custom targeting such as running a campaign only for paid user of your app, then you can select Custom Variable.

1360

Custom Variable

A custom variable is useful when you want to target a campaign on variables and conditions set by your code.
To use a custom variable, define a variable name and a corresponding value in the dashboard.
In your app code, call methods to set values for these custom variables using
VWOConfig#setCustomVariables(Map<String, String>).

Map<String, String> customKeys = new HashMap<>();
customKeys.put("user_type", "paid");
VWOConfig vwoConfig = new VWOConfig
  .Builder()
  .setCustomVariables(customKeys)
  .build();

VWO.with(this, VWO_API_KEY).config(vwoConfig).launch(null);
val customKeys = HashMap<String, String>()
customKeys["user_type"] = "paid"
val vwoConfig = VWOConfig.Builder()
  .setCustomVariables(customKeys)
  .build()

VWO.with(this, VWO_API_KEY).config(vwoConfig).launch(null)

If you do not wish to pass the customVariables at the time of VWO launch, you can pass them using the setCustomVariable(String, String) method after the VWO SDK is initialized.

VWOConfig vwoConfig = new VWOConfig.Builder().build();

VWO.with(this, VWO_API_KEY).config(vwoConfig).launch(null);

VWO.setCustomVariable("user_type", "paid");
val vwoConfig = VWOConfig.Builder()
  .build()

VWO.with(this, VWO_API_KEY).config(vwoConfig).launch(null)
  
VWO.setCustomVariable("user_type", "paid");

When to set custom variables

  • If in the campaign, you have specified certain custom variables, their values have to be set in the code before calling the getObjectForKey(String key, Object defaultValue) method.

  • If you have set Make user part of the campaign on app launch in the VWO dashboard, then custom variables should be set before launching the SDK. This is required else SDK will try to make the user a part of the campaign on app launch.

1464