Reference API Roblox

Engine API

Website

Related

Reference API Roblox

RecommendationService

A service that provides an interface for developers to manage and display personalized content recommendations.

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 7

HistoryMember
678GenerateItemListAsync(generateRecommendationItemListRequest: Dictionary): RecommendationPages
690GetRecommendationItemAsync(itemId: string): Dictionary
678LogActionEvent(actionType: RecommendationActionType, itemId: string, tracingId: string, actionEventDetails: Dictionary = nil): null
678LogImpressionEvent(impressionType: RecommendationImpressionType, itemId: string, tracingId: string, impressionEventDetails: Dictionary = nil): null
683RegisterItemAsync(player: Player, registerRecommendationItemsRequest: Dictionary): Dictionary
678RemoveItemAsync(itemId: string): null
678UpdateItemAsync(updateRecommendationItemRequest: Dictionary): null
inherited from Instance
553Archivable: bool
670Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
670Sandboxed: bool
680UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
691GetPredictionMode(): PredictionMode
641GetStyled(name: string): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
690IsPredicted(): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
690SetPredictionMode(mode: PredictionMode): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

RecommendationService provides an interface for developers to manage and display personalized content recommendations. It supports creating, retrieving, updating, and deleting recommendation items, as well as generating lists of recommended content for users. Additionally, it includes functionality for logging user interactions, such as views and actions, to help refine and improve recommendation quality.

Note: RecommendationService is currently available for free, but its pricing model might change in the future.

History 9

Members 7

GenerateItemListAsync

Parameters (1)
generateRecommendationItemListRequestDictionary
Returns (1)
RecommendationPages

This function returns a paginated list of recommended items based on a given request. The request can specify criteria such as configuration name, location, and page size to tailor the recommendations. It returns a RecommendationPages object that can be used to iterate through the list of items.

The ConfigName parameter determines how the recommendation engine ranks and returns items. For example, you can have configurations that optimize for views, likes, or purchases. For the ranking to be effective, you must ensure that you are logging the corresponding user interactions using LogImpressionEvent and LogActionEvent.

Supported ConfigName are:

  • MaximizeTimespent: Optimizes recommendations to prioritize content that engages users for longer periods.
  • MaximizeReactions: Optimizes recommendations to highlight content that generates the most user reactions, such as likes and favorites.
  • MaximizeEngagement: Optimizes recommendations through a balanced approach that considers multiple engagement signals, including quality views and reactions. This config is designed to highlight content that performs well across different engagement areas.
  • PlayerSpecific: Returns public items created by the player specified in the request and sorted by the most recent creation time. To use this config, you must pass the UserId in the CustomContexts.
  • RecentlyAdded: Returns items sorted by how recent they are, and displays the most recently added public content first.
  • MaximizeJoins: (Coming soon) Optimizes recommendations to prioritize game joins. This config is currently only available for Roblox Moments.
  • PlayerOwnedItems: Displays the user's own creations sorted by creation time. This config requires user authentication because it displays private items. This config is only available on the client.

This function can be called from both the server and the client. When called from the server, you must pass the UserId in the CustomContexts.

This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

GetRecommendationItemAsync

Parameters (1)
itemIdstring
Returns (1)
Dictionary

This function returns a single recommendation item by its ItemId. This is useful for getting the details of a specific item without having to fetch a whole list.

This function can be called only from the server.

This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

LogActionEvent

Parameters (4)Default
actionTypeRecommendationActionType
itemIdstring
tracingIdstring
actionEventDetailsDictionarynil
Returns (1)
null

This function logs a user action on a recommended item, such as a "like," "share," or "purchase." It requires the itemId of the item and a tracingId from the GenerateItemListAsync response to link the action to a specific recommendation context. Additional details about the action can be provided in the actionEventDetails dictionary.

Logging actions is essential for recommendation configurations that rank items based on user engagement such as number of likes or purchases.

This function can only be called from the client.

Note: Only LogActionEvent calls in production actually log actions. Calling this function in Studio doesn't have any effect; you can call it as many times as you want when testing.

History 1

LogImpressionEvent

Parameters (4)Default
impressionTypeRecommendationImpressionType
itemIdstring
tracingIdstring
impressionEventDetailsDictionarynil
Returns (1)
null

This function logs an impression event, such as a user viewing a recommended item. It requires the itemId and a tracingId to associate the impression with the recommendation context. Details like view duration and position can be passed in the impressionEventDetails dictionary to provide more context for the recommendation engine.

Logging impressions, especially Duration, is critical for recommendation configurations that rank items based on view time.

This function can only be called from the client.

Note: Only LogImpressionEvent calls in production actually log impressions. Calling this function in Studio doesn't have any effect; you can call it as many times as you want when testing.

History 1

RegisterItemAsync

Parameters (2)
playerPlayer
registerRecommendationItemsRequestDictionary
Returns (1)
Dictionary

This function registers a new item to be included in recommendations. It requires a player object and a registerRecommendationItemsRequest dictionary containing details about the item, such as its content type, reference ID, and custom tags. It returns a dictionary with the ItemId and the ReferenceId of the newly registered item.

The ItemId is a unique ID returned by the RecommendationService. All functions in the RecommendationService use the ItemId as input and output.

The ReferenceId is a developer-provided identifier for an item. To make sure that this reference ID is unique, we recommend that you use a UUID. You can use this reference ID as a key to store rendering-specific metadata in a data store.

When you register an item, you should only provide information that is relevant for ranking and recommendations. All other data needed for rendering should be stored separately in, for example, a data store. This approach decouples the recommendation logic from the rendering process, and results in a system that is more modular and easier to maintain.

Attributes is a list of content attributes associated with the item. Each attribute in the list can contain the following fields:

  • AssetId — The ID of an asset, such as an image or video.
  • Text — A short text string, like a title.
  • Description — A longer text description for the attribute.
  • SeekStartTime / SeekEndTime — The start and end times for seeking within video content.
  • TrimStartTime / TrimEndTime — The start and end times for trimming video content.

This function can only be called from the server.

This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

RemoveItemAsync

Parameters (1)
itemIdstring
Returns (1)
null

This function removes an item from the recommendation system. It takes the itemId of the item to be deleted as a parameter.

This function can be called from both the server and the client, with the following limitations:

  • When called from the server, it can only remove items registered under the same universeId.
  • When called from the client, it can only remove items registered by the current player.
This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

UpdateItemAsync

Parameters (1)
updateRecommendationItemRequestDictionary
Returns (1)
null

This function updates the attributes of an existing recommendation item. It takes an updateRecommendationItemRequest dictionary containing the itemId and the fields to be updated. Any fields not included in the request will remain unchanged.

Items with their RecommendationItemVisibility set to Private are not recommended to other users, but they can still be returned when a user requests their own creations by using the ConfigName of PlayerOwnedItems.

In Roblox Moments, moderated items are set to Private. While this prevents other users from seeing them, the item creator can still see these moderated items and check their moderation status in their My Moments tab.

This function can only be called from the server.

This function yields. It will block the calling thread until completion.

History 1

Tags: [Yields]

Settings