Getting Started
0. Supported Versions
- Modern browsers (Chrome, Edge, Firefox, Safari etc)
- IE browsers are not supported.
1. Loading the GFP Web SDK Library
- To load a SDK, add the
<script>tag to<head>as below. - Loading a SDK is a single-time process when loading the page for the first time.
- With SPA (Single Page Application), loading a SDK into its index page is recommended. Sample Code with React.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello GFP SDK</title>
<script async src="https://ssl.pstatic.net/tveta/libs/glad/prod/gfp-core.js"></script>
</head>
<body></body>
</html>
SDK Information by Deployment Environment
To test ads in Naver's internal test environment, you need to load the SDK for the TEST environment.
Please refer to the table below and set the SDK URL according to the deployment environment.
| Deployment Environment | SDK URL | SSP Ad Request Domain |
|---|---|---|
| TEST | https://test-img.tveta.naver.net/libs/glad/test/gfp-core.js | test-gfp.veta.naver.com |
| REAL | https://ssl.pstatic.net/tveta/libs/glad/prod/gfp-core.js | gfp.veta.naver.com |
2. Generate a command queue of gladsdk
-
Initialize
gladsdk.cmdto create a command queue for using a SDK.<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello GFP</title>
<script async src="https://ssl.pstatic.net/tveta/libs/glad/prod/gfp-core.js"></script>
<script>
window.gladsdk = window.gladsdk || { cmd: [] };
</script>
</head>
</html> -
Once GFP SDK is loaded, it processes pending commands in a gladsdk.cmd
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello GFP</title>
<script async src="https://ssl.pstatic.net/tveta/libs/glad/prod/gfp-core.js"></script>
<script>
window.gladsdk = window.gladsdk || { cmd: [] };
window.gladsdk.cmd.push(function () {
console.log('GFP SDK LOADED!');
});
</script>
</head>
</html>
Since the window.gladsdk method does not exist before loading a GFP SDK, all window.gladsdk methods must be executed within the gladsdk.cmd command queue.
For more information, please refer to Troubleshooting - gladsdk.cmd not used.
3. Define an GFP ad slot
-
Use gladsdk.defineAdSlot() to define an ad slot.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello GLAD</title>
<script async src="https://ssl.pstatic.net/tveta/libs/glad/prod/gfp-core.js"></script>
<script>
window.gladsdk = window.gladsdk || { cmd: [] };
window.gladsdk.cmd.push(function () {
var adSlotInfo = {
adUnitId: 'WEB_nw_banner-N345765840',
adSlotElementId: 'division',
};
window.gladsdk.defineAdSlot(adSlotInfo);
});
</script>
</head>
</html>dangerWEB_nw_banner-N345765840is an ad unit ID for testing examples.In the actual application, you should set the ad unit ID issued by the media manager.
4. Designate the ad container for ad displaying and Display an ad
-
Create
<div>where the advertisement will be displayed and set theID.The id property value of this element should be the same as the adSlotElementId value set when creating the ad slot.
<body>
<div id="division"></div>
</body> -
Use gladsdk.displayAd() to display the ad.
<body>
<div id="division"></div>
<script>
window.gladsdk.cmd.push(function () {
window.gladsdk.displayAd('division');
});
</script>
</body>
5. Final sample code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test GFP SDK</title>
<script async src="https://ssl.pstatic.net/tveta/libs/glad/prod/gfp-core.js"></script>
<script>
window.gladsdk = window.gladsdk || { cmd: [] };
window.gladsdk.cmd.push(function () {
var adSlotInfo = {
adUnitId: 'WEB_nw_banner-N345765840',
adSlotElementId: 'division',
};
window.gladsdk.defineAdSlot(adSlotInfo);
});
</script>
</head>
<body>
<div id="division"></div>
<script>
window.gladsdk.cmd.push(function () {
window.gladsdk.displayAd('division');
});
</script>
</body>
</html>