With rewarded video ads, you can implement a reward mechanism inside your experience to incentivize users to watch click-to-play video ads.
Implement rewarded video ads
To implement a rewarded video ad, you must set up the video ad inside your experience, create a client-side script that checks if a video ad is available to be played to the user, and then create a server-side script that turns a developer product into a reward, shows the user the video ad, and grants the user their reward.
Video ad setup
To set up a rewarded video ad inside your experience:
- Open the experience in Studio and select the location where you want to trigger the video ad.
- Go to the Game Settings menu and check the Enable Rewarded Video Ads checkbox.
- Select the reward you want to grant the user. If the reward doesn't already exist, create a new developer product in the Creator Hub.
- Insert a button that the user must press before the video ad starts playing.
Client-side implementation
To implement the rewarded video ad on the client-side:
- Add a new LocalScript to the button you just implemented.
- Use the GetAdAvailabilityNowAsync method to make sure the button is only visible to the user if an ad is available.
Code example for rewarded video ad (Client)
-- Client (LocalScript in a UI button)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AdService = game:GetService("AdService")
local requestShowAdEvent = ReplicatedStorage:WaitForChild("RequestShowAdEvent")
local recheckAdAvailabilityEvent = ReplicatedStorage:WaitForChild("RecheckAdAvailabilityEvent")
-- Assume the script is a child of the button
local adButton = script.Parent
-- Hide the UI button until the video ad availability is confirmed
adButton.Visible = false
local function checkAdAvailability()
local adAvailability = AdService:GetAdAvailabilityNowAsync(Enum.AdFormat.RewardedVideo)
if adAvailability.AdAvailabilityResult == Enum.AdAvailabilityResult.IsAvailable then
-- If the video ad is available, show the UI button
adButton.Visible = true
else
-- If the video ad is not available, hide the UI button
adButton.Visible = false
-- Recheck ad availability after 60 seconds
task.delay(60, checkAdAvailability)
end
end
-- Check if the video ad is available
checkAdAvailability()
-- Use Activated event
adButton.Activated:Connect(function()
requestShowAdEvent:FireServer()
end)
recheckAdAvailabilityEvent.OnClientEvent:Connect(function()
checkAdAvailability()
end)
Server-side implementation
To implement the rewarded video ad on the server-side:
- Create a new Script under ServerScriptService.
- Use the CreateAdRewardFromDevProductId method to pass the developer product ID of the reward and create an AdReward object.
- Use the ShowRewardedVideoAsync method to play the video ad to the user.
- (Optional) Add a placementId to track individual video ad placements inside your experience.
- Use the ProcessReceipt method to grant the user their reward if they have watched the entire video ad.
Code example for rewarded video ad (Server)
-- Server (Script in ServerScriptService)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AdService = game:GetService("AdService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
-- Confirm that the EnableRewardedVideoAds setting is enabled in the experience settings
local requestShowAdEvent = Instance.new("RemoteEvent")
requestShowAdEvent.Name = "RequestShowAdEvent"
requestShowAdEvent.Parent = ReplicatedStorage
local recheckAdAvailabilityEvent = Instance.new("RemoteEvent")
recheckAdAvailabilityEvent.Name = "RecheckAdAvailabilityEvent"
recheckAdAvailabilityEvent.Parent = ReplicatedStorage
-- Provide a developer product ID for the video ad reward
local rewardDevProductId = 12345
local function processReceipt(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if receiptInfo.ProductId == rewardDevProductId then
print(player.Name .. " earned the reward!")
-- Include the logic for granting rewards here
return Enum.ProductPurchaseDecision.PurchaseGranted
end
return Enum.ProductPurchaseDecision.NotProcessedYet
end
MarketplaceService.ProcessReceipt = processReceipt
requestShowAdEvent.OnServerEvent:Connect(function(player)
local reward = AdService:CreateAdRewardFromDevProductId(rewardDevProductId)
local result = AdService:ShowRewardedVideoAdAsync(player, reward, placementId)
-- Handle specific ad result cases
if result == Enum.ShowAdResult.AdNotReady then
warn("Ad not ready for player: " .. player.Name)
elseif result == Enum.ShowAdResult.InternalError then
warn("Internal error showing ad for player: " .. player.Name)
-- Add more cases as needed (for example, ShowInterrupted, AdAlreadyShowing, etc)
...
end
-- Signal the Client to recheck if video ad is available
recheckAdAvailabilityEvent:FireClient(player)
end)
Placements
Use placements to track the performance of individual rewarded video ads inside your experience.
To create a rewarded video ad placement:
- In the Creator Dashboard, go to Creations and select an experience.
- Go to Monetization > Ads > Placements.
- Click Create Placement.
- Enter a name for the placement and click Create.
The new placement populates on the Placement table with a unique Placement ID. You can use this Placement ID in the ShowRewardedVideoAsync method to differentiate between and track metrics for the individual video ads inside your experience.
Analytics
Use analytics metrics to evaluate the effectiveness of your rewarded video ads, test different reward types to identify the ones that best resonate with your audience, and measure how often users watch entire video ads to claim rewards.
To access your rewarded video ad metrics:
- In the Creator Dashboard, go to Creations and select an experience.
- Go to Monetization > Ads > Analytics.
- Filter by Rewarded Video to see all of the available metrics.
Metric | Description |
---|---|
Earnings (Robux) | Total revenue amount in Robux earned from rewarded video ads in your experience. Different lines show you this metric for different ad placements inside the experience. |
Monetization Funnel at Experience level | This metric shows you:
|
Fill Rate | The percentage of requests that had an ad returned as a reponse. |
EPM (Robux Earnings per Mille) | Your effective Robux earnings per thousand impressions. Calculated by total earnings / the number of impressions (in thousands) in your experience. Different lines show you this metric for different ad placements inside the experience. |
Impressions | The number of rewarded video ads shown in your experience. Different lines show you this metric for different ad placements inside the experience. |
Rewarded | The number of rewards granted for video ad views in your experience. Different lines show you this metric for different ad placements inside the experience. |
DUV (Daily Unique Views) | The number of unique users who have viewed one or more video ads in your experience in a day. A view is defined by an impression. This data is updated with 1 day delay. |
AEPDUV (Average Earnings Per Daily Uniquer Viewers) | The earnings generated per daily unique viewer for rewarded video ads. This data is updated with 1 day delay. |
DUV/DAU (Daily Unique Views/Daily Active Users) | The percentage of unique users who have viewed a video ad in a day divided by the total number of users who joined your experience that day. This data is updated with 1 day delay. |
Eligibility requirements
To prevent abuse of the rewarded ad system and to provide the best user experience possible, you must follow the eligibility requirements when you implement rewarded video ads.
Experiences | To offer rewarded video ads, your experience must:
|
Publishers | To implement rewarded video ads, you must:
|
Rewards | The reward for watching a video ad should:
|
Any violation of the eligilibity requirements can result in account suspension, removal of content, revocation of ad payouts, or loss of eligibility to earn from ads.
Best practices
To get the most out of your rewarded video ad, make sure to:
- Scale rewards so that they remain valuable to your users as they advance through the experience.
- Adjust the frequency of rewards based on user engagement and feedback.
- Use analytics to identify the best placement for video ads to encourage user engagement without disrupting gameplay.