๐Ÿช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 object

  • screenCoveragePercentage: number โ€” Percentage visible

  • timeInMilliseconds: number โ€” Time in ms the ad was visible

  • angleView?: 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