-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (55 loc) · 2.06 KB
/
index.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<html>
<head>
<meta charset="utf-8">
<title>Insert DIV after Paragraph</title>
<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('/200894144/Responsive', [[300,250]], 'slot-1')
.addService(googletag.pubads());
googletag.defineSlot('/200894144/Responsive', [[728,90]], 'slot-2')
.addService(googletag.pubads());
googletag.defineSlot('/200894144/Responsive', [[970,250]], 'slot-3')
.addService(googletag.pubads());
googletag.pubads().setTargeting('Test_mode', ['ON']);
googletag.enableServices();
});
//Calling display ad slots
googletag.cmd.push(function() {
googletag.display('slot-3');
});
googletag.cmd.push(function() {
googletag.display('slot-1');
});
</script>
<style>
.buttons {
display: flex;
justify-content: center
}
</style>
</head>
//Sample Site Content
<body>
<p> This is 1st paragragh</p>
<p> This is 2nd paragragh</p>
<p> This is 3rd paragragh</p>
<p> This is 4th paragragh</p>
<p> This is 5th paragragh</p>
<p> This is 6th paragragh</p>
</body>
</html>
//Custom Script for inserting DIV
<script id="rendered-js" >
var adcontainer1 = document.querySelector("body > p:nth-child(2)");
var inner = document.createElement("div");
inner.setAttribute("id","slot-1");
inner.setAttribute("style","width: 300px; height:250px");
adcontainer1.appendChild(inner);
var adcontainer2 = document.querySelector("body > p:nth-child(5)");
var inner = document.createElement("div");
inner.setAttribute("id","slot-3");
inner.setAttribute("style","width: 970px; height:250px");
adcontainer2.appendChild(inner);
</script>