Skip to content

Instantly share code, notes, and snippets.

@bjnhur
Last active March 5, 2020 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjnhur/4a66f00028a59bd9a3e0f2da3dc1add6 to your computer and use it in GitHub Desktop.
Save bjnhur/4a66f00028a59bd9a3e0f2da3dc1add6 to your computer and use it in GitHub Desktop.
<html>
<head>
// JQuery 라이브러리 추가하기, 다음 티스토리 스킨에서 활용중인 코드를 예제로 추가
<script src="//t1.daumcdn.net/tistory_admin/lib/jquery/jquery-1.12.4.min.js"></script>
// Google Adsense 모듈을 위한 라이브러리 코드 추가하기
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</head>
<body>
...
// 광고를 가운데 배치하기 위한 div1
<div style="margin: 10px auto 10px;text-align: center">
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" data-ad-slot="xxxxxxxxxx" data-ad-format="auto" data-full-width-responsive="true"></ins>
</div>
...
// 광고를 가운데 배치하기 위한 div2
<div style="margin: 10px auto 10px;text-align: center">
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" data-ad-slot="xxxxxxxxxx" data-ad-format="auto" data-full-width-responsive="true"></ins>
</div>
...
// 광고를 가운데 배치하기 위한 div3
<div style="margin: 10px auto 10px;text-align: center">
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxxxxxxxxxxxx" data-ad-slot="xxxxxxxxxx" data-ad-format="auto" data-full-width-responsive="true"></ins>
</div>
...
<script>
// push code for Adsense modules in the page
// from https://www.pincoin.co.kr/blog/www/10/multiple-adsense-ads-on-a-single-page/
$(window).on('load', function () {
$(".adsbygoogle").each(function () {
(adsbygoogle = window.adsbygoogle || []).push({});
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment