前期准备

1.获取Google代码

获取代码

Google Ad Manager获取代码

代码示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
谷歌代码左右组合:
网易PC-首页-T-01-左:
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || {cmd: []};
googletag.cmd.push(function() {
googletag.defineSlot('/21825104460/163-1-T-01-L', [890, 125], 'div-gpt-ad-1579317211567-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

<!-- /21825104460/163-1-T-01-L -->
<div id='div-gpt-ad-1579317211567-0' style='width: 890px; height: 125px;'>
<script>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1579317211567-0'); });
</script>
</div>


网易PC-首页-T-01-右:
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || {cmd: []};
googletag.cmd.push(function() {
googletag.defineSlot('/21825104460/163-1-T-01-R', [300, 125], 'div-gpt-ad-1579317255890-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

<!-- /21825104460/163-1-T-01-R -->
<div id='div-gpt-ad-1579317255890-0' style='width: 300px; height: 125px;'>
<script>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1579317255890-0'); });
</script>
</div>
代码上线
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<div style="width:1200px;overflow: hidden;">
<div style="display: inline-block;">
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || { cmd: [] };
googletag.cmd.push(function () {
googletag.defineSlot('/21825104460/163-1-T-01-L', [890, 125], 'div-gpt-ad-1579317211567-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
<!-- /21825104460/163-1-T-01-L -->
<div id='div-gpt-ad-1579317211567-0' style='width: 890px; height: 125px;'>
<script>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-1579317211567-0'); });
</script>
</div>
</div>
<div style="display: inline-block;">
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || { cmd: [] };
googletag.cmd.push(function () {
googletag.defineSlot('/21825104460/163-1-T-01-R', [300, 125], 'div-gpt-ad-1579317255890-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
<!-- /21825104460/163-1-T-01-R -->
<div id='div-gpt-ad-1579317255890-0' style='width: 300px; height: 125px;'>
<script>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-1579317255890-0'); });
</script>
</div>
</div>
</div>
注意事项

1.替换代码结构如下:
<div style="display: inline-block;"> 跨域代码 </div>
2.标签中的跨域代码即可