Publishing Games
Embedding Games via iFrame and Native Applications
Integrating Playgent games into your platform is straightforward, whether you're embedding them on a website or within a native mobile application. Below are the methods to seamlessly incorporate our games into your environment.
Embedding Games via iFrame
To embed a game on your website using an iFrame, insert the following HTML code into your webpage:
<iframe
src="https://player.playgent.com/games/<game_type>/<publish_key>"
width="100%"
height="700px"
frameborder="0"
allowfullscreen
allow="web-share"
></iframe>Replace <publish_key> and <game_type> with your specific game publish key and game type. This iFrame is responsive, adapting to various screen sizes, and ensures a consistent user experience. For more details, refer to our [Games Integration Guide][1].
Integrating Games into Native Applications
For native mobile applications, you can integrate Playgent games using WebView components. Below are examples for iOS and Android platforms.
iOS Integration
Utilize the WKWebView class to embed the game within your iOS application:
import WebKit
class GameViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let webView = WKWebView(frame: view.bounds)
webView.load(URLRequest(url: URL(string: "https://player.playgent.com/games/<game_type>/<publish_key>")!))
view.addSubview(webView)
}
}Ensure you replace <publish_key> with your actual game publish key. This setup allows the game to run seamlessly within your app. For more information, consult our [Games Integration Guide][1].
Android Integration
In Android, use the WebView component to embed the game:
WebView webView = findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://player.playgent.com/games/<game_type>/<publish_key>");Replace <publish_key> with your specific game publish key. This approach ensures smooth integration of the game within your Android application. Detailed instructions are available in our [Games Integration Guide][1].
Platform-Specific Integration
Playgent supports integration with various platforms. Below are platform-specific instructions:
| Platform | Integration Method |
|---|---|
| WordPress | Use the [iframe] shortcode: [iframe src="https://player.playgent.com/games/<game_type>/<publish_key>" width="100%" height="700"] |
| Wix | Add an "HTML iframe" element and insert the iFrame code provided above. |
| Squarespace | Add a "Code" block and insert the iFrame code provided above. |
| Framer | Add a new "Embed" component and use the game URL: https://player.playgent.com/games/<game_type>/<publish_key>. |
| Webflow | Add an "Embed" element and insert the iFrame code provided above. |
| Shopify | Add a "Custom HTML" section and insert the iFrame code provided above. |
| Weebly | Add an "Embed Code" element and insert the iFrame code provided above. |
| Joomla | Use the {source} tags: {source}<iframe src="https://player.playgent.com/games/<game_type>/<publish_key>" width="100%" height="700" frameborder="0"></iframe>{/source} |
Replace <publish_key> with your specific game publish key in all instances.