-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
interstitial_ads.html
150 lines (89 loc) · 3.44 KB
/
interstitial_ads.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<html>
<head>
<script type="text/javascript" src="cordova.js"></script>
</head>
<body>
<label for="event">Debug Event All response :</label>
<textarea id="event" name="event" rows="5" cols="40"></textarea>
<script>
let event = document.getElementById('event');
let cleanText = () => { event.value = '' };
// WARNING config must be an array[] not an object{}
const config_Interstitial = [
adUnitId = "ca-app-pub-3940256099942544/1033173712",
autoShow = true
]
// how does the onclick button call a function inside the deviceready block? view https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/blob/main/example/banner_ads.html
// Load Interstitial Ad
let loadInterstitialAd = () => {
cordova.plugins.emiAdmobPlugin.loadInterstitialAd(config_Interstitial);
// Or like this
// cordova.plugins.emiAdmobPlugin.loadInterstitialAd([adUnitId = "ca-app-pub-3940256099942544/1033173712", autoShow = false ]);
// call loadInterstitialAd();
}
// Show Interstitial Ad
let showInterstitialAd = () => {
cordova.plugins.emiAdmobPlugin.showInterstitialAd();
// call showInterstitialAd();
}
///// >>>>>> Device Ready <<<<<<
document.addEventListener("deviceready", function(){
// WARNING config must be an array[] not an object{}
const config_globalSettings = [
// DEPRECATED enableSameAppKey
setAppMuted = false, // Type Boolean default: false
setAppVolume = 1.0, // Type float default: 1
publisherFirstPartyIdEnabled = true, // Type Boolean default: true // enableSameAppKey
npa = "1", // string "0" | "1" // DEPRECATED Beginning January 16, 2024
enableCollapsible = true, // (BETA) activate the collapsible banner ads
responseInfo = false, // For debugging and logging purposes
]
cordova.plugins.emiAdmobPlugin.globalSettings(config_globalSettings);
// Must be under globalSetting and targeting
cordova.plugins.emiAdmobPlugin.initialize();
// SDK EVENT Initialization
document.addEventListener('on.sdkInitialization', () => {
event.value += ("\n On Sdk Initialization");
});
// interstitial Ad EVENT
/*
on.interstitial.loaded
on.interstitial.failed.load
on.interstitial.click
on.interstitial.dismissed
on.interstitial.failed.show
on.interstitial.impression
on.interstitial.show
on.interstitial.revenue
*/
document.addEventListener('on.interstitial.loaded', () => {
event.value += ("\n on.interstitial.loaded");
});
document.addEventListener('on.interstitial.failed.load', () => {
event.value += ("\n on.interstitial.failed.load");
});
document.addEventListener('on.interstitial.click', () => {
event.value += ("\n on.interstitial.click");
});
document.addEventListener('on.interstitial.dismissed', () => {
event.value += ("\n on.interstitial.dismissed");
});
document.addEventListener('on.interstitial.failed.show', () => {
event.value += ("\n on.interstitial.failed.show");
});
document.addEventListener('on.interstitial.impression', () => {
event.value += ("\n on.interstitial.impression");
});
document.addEventListener('on.interstitial.show', () => {
event.value += ("\n on.interstitial.show");
});
document.addEventListener('on.interstitial.revenue', () => {
event.value += ("\n on.interstitial.revenue");
});
}, false);
</script>
<p> <button onclick="loadInterstitialAd();">Load Interstitial Ad</button></p>
<p> <button onclick="showInterstitialAd();">Show Interstitial Ad</button></p>
<p> <button onclick="cleanText();">Clean response Text</button></p>
</body>
</html>