๐ชuseReneVerse
The useReneVerse hook is your go-to for handling Smart Ad logic in Phaser 3.
These hooks enable ad serving, retrieval of ad surfaces, and ad tracking, simplifying the integration of advertising features into your projects.
๐ฅ getAdSurfaces()
Description: Fetches all ad surfaces configured for your game in the ReneVerse Portal.
import { PhaserHooks } from "@reneverse/rene-sdk-phaser";
function App() {
// Initialize PhaserHooks with API Key and Private Key for ReneVerse
const phaserHooks = new PhaserHooks({
apiKey: '<YOUR API KEY>',
privateKey: '<YOUR PRIVATE KEY>',
});
const getAdSurfaces = async () => {
// Fetch all Ad surfaces configured in your game on the ReneVerse portal
const adSurfaces = await phaserHooks.useReneVerse().getAdSurfaces();
console.log(adSurfaces);
}
// Creating a button to call the getAdSurfaces function
return (
<div>
<button onClick={getAdSurfaces}>
Get Ad Surfaces
</button>
</div>
);
}
export default App;Returns
๐ฏ getAd()
Description: Fetches a Smart Ad for the given ad surface.
Params
adSurfaceId : string
Returns
๐๏ธ trackAdSingle()
Description: Tracks a single adโs visibility and view time. Records impressions for served Ads.
Params
ad : type ServeAdโ The served ad objectscreenCoveragePercentage: numberโ Percentage visibletimeInMilliseconds: numberโ Time in ms the ad was visibleangleView?: numberโ Viewing angle
Returns
๐ trackAdMultiple()
Description: Aggregate and record impressions for several served ads concurrently, reducing individual tracking overhead and streamlining analytics collection.
Params
adDataList : [{ ad : type ServeAd screenCoveragePercentage: number timeInMilliseconds: number angleView?: number }]
Returns
Last updated

