Gating Features
Implementing Gated Features with playgen.io
playgen.io offers a robust access control mechanism for features like leaderboards, archives, and stats. When a feature is set as gated, players attempting to access it will trigger a request event instead of directly opening the screen. This allows you to manage access by requiring authentication, subscription, or other conditions before the feature is unlocked.
How Access Control Works
-
Gating a Feature:
- In your playgen.io dashboard, you can configure features like Leaderboard, Archive, or Stats to be gated. Once enabled, access to these features will be restricted.
-
Request Event Triggered:
- When a player tries to access a gated feature, a request event is sent from the game. For example, if the leaderboard is gated, the game will send a
PLAYGEN_REQUEST_LEADERBOARD
event instead of opening the leaderboard screen.
- When a player tries to access a gated feature, a request event is sent from the game. For example, if the leaderboard is gated, the game will send a
-
Listening for Request Events:
- Your app needs to listen for these request events to handle the access control logic. You can capture these events using an event listener. Here’s an example:
-
Responding with
PLAYGEN_RESOLVER
Event:- After detecting a request event, you must send a
PLAYGEN_RESOLVER
event back to the game iframe to grant or deny access. This event includes parameters indicating whether the feature is unlocked. Here’s an example of sending thePLAYGEN_RESOLVER
event:
- After detecting a request event, you must send a
-
Debugging in the Playground:
- The Playground in the game editor is an excellent tool to test and visualize these events. You can use it to monitor request and resolver events in real-time, ensuring your access control logic works correctly.
Use Cases for Access Control
Access control can be utilized to implement various features that enhance user engagement and revenue generation:
- Loginwall Integration: Require users to log in before accessing certain features, enhancing data collection and user retention.
- Paywall Integration: Implement a subscription model where users need to pay to access premium features like archives or detailed stats.
- Lead Generation: Prompt users to fill out a form or provide contact information before accessing restricted features, allowing you to capture leads.
- Ad-Supported Access: Offer access to premium features in exchange for watching an ad, providing an alternative revenue stream.
By leveraging playgen.io’s access control features, you can customize the player experience, drive engagement, and generate additional revenue streams based on user interactions.