Skip to main content
Version: 3.x

User Attributes and Targeting

User attributes are a way to store additional information about a user. They are key-value pairs that can be used to store information such as a user's game level, payer status, or any other information that is useful to your organization.

Targeting based on user attributes

info

Attributes that you can filter on only show up once they've been sent from the SDK

In this example, we are targeting users in France. You can add up to 3 filters per piece of content.

Note: Capping and pacing is only available for currency sale banner content type, not Multiple Choice questions.

Banner targeting

Shown is a partial list of targeting criteria that has been received by Tap. Sending different attributes will allow you to target different users.

Banner targeting

There are different targeting operators. You can use = to match on a specific value, or contains to match on a list of values.

Numerical values can be matched using =, >=, and <=

Banner targeting

There are several limitations that you should be aware of when using user attributes:

  • Case sensitivity - User attributes are case sensitive. This means that test and Test are different attributes.
  • Dates - Dates are stored as strings. This means that 2020-01-01 and 2020-1-1 are different attribute values.
  • Booleans - Do not use booleans. Either stringify the value so that true becomes "true" or use integer values like 0 and 1.
  • Integer vs String - Integers are stored as integers. This means that 1 and "1" are different attribute values. If you want to match on 1 or >= 1 then please send integer values.

Built-in attributes

There are two built-in attributes that are automatically sent by the SDK:

  • Country - This is the country that the user is in
    • Target using the 2 letter country code, ex: US for United States, based on the ISO standard
  • First Seen At - This is the first time that TapResearch has seen this users.
    • Target with iso8601 date strings, ex: 2020-01-01T00:00:00.000Z for January 1st, 2020 at midnight UTC
    • This is a relative date, so you can target on days ago as well by using the string 3d to target anything before 3 days ago
    • You can also use just the date, so 2020-01-01 is the same as 2020-01-01T00:00:00.000Z

Examples

userAttributes = hashMapOf(
"testStatus" to "VIP",
"testInt" to 2,
"testIntString" to "2",
"vip_status" to "super-vip",
"Some Date" to Instant.now().toString(), // 2023-08-31T10:15:30.00Z
// The below will match on relative dates, so you can filter by "a Month Ago" >= 3d
"a Month Ago" to LocalDate.now().minus(1, ChronoUnit.MONTHS).toString(), // 2023-07-31
"testCAPSUpper" to "CAPS", // Matches "CAPS" but not "caps"
"testCAPSLower" to "caps", // Matches "caps" but not "CAPS"
),

Techie Details

Attribute caching

  • There is a 1m cache on the backend for user attributes.
    • This means it can take up to 1m for a change to be reflected when your querying for content and an attribute has changed

Examples:

Example 1:

The user has seen a placement, levels up, and sees the same content for that placement.

playerLevel = 1 changes to playerLevel = 2

You have two pieces of content, one for level 1 and one for level 2.

  • The user shows content for a placement
  • The user's level is 1
  • The user plays the game and levels up to 2
  • The user clicks the placement again and its been less than 1m
  • The user sees the same content for that placement, not the level 2 content

Example 2:

You have two pieces of content, one for attribute 1 and one for attribute 2.

attribute1 = 1

You add an attribute

attribute2 = 2

The user has seen a placement, gets an additional attribute they did not have before, and sees new content for that placement

  • The user shows content for a placement
  • The user has an additional attribute added to their user attributes that did not exist before
  • The user clicks the placement again and its been less than 1m
  • The user sees the new content for that placement, based on the filters for that content

Example 3: (Dates)

  • Relative dates
    • You want to show content to users who have been playing for 1 month
    • You'll want to target where First seen at <= 30d
  • Absolute dates
    • You want to show content to users who have been playing for 1 month
    • You'll want to target where First seen at <= 2020-01-01T00:00:00.000Z

Example 4: (Booleans)

  • A user is a VIP
    • String
      • Send the attribute is_vip = "true"
      • You'll want to target where is_vip = "true"
    • Integer
      • Send the attribute is_vip = 1
      • You'll want to target where is_vip = 1

Example 5: (A list of attributes)

  • You have multiple user types and want to target some of them
    • Send the attribute user_type = "vip" or user_type = "normal" or user_type = "super-vip"
    • Target where user_type = "vip" or user_type = "super-vip" using the contains operator in the UI

Troubleshooting

If you are not matching content, check the following:

  • If you are sending a string as an integer, ex: "1" instead of 1, this will not match.
    • This is because the SDK will send the value as a string, and the backend will try to match it as an integer.
    • Please send the value as an integer, ex: 1 for proper matching