Free javascript Hosting


sc-script-flow-1.js

Uploaded on Dec 24 2021 13:30 by vinaypatel1610

(function () {
var currScript = document.currentScript;
var parentElm = currScript && currScript.parentNode;
var height = parentElm.getAttribute("data-sc-height");
var width = parentElm.getAttribute("data-sc-width");
var gaid = parentElm.getAttribute('data-sc-gaid');
// get creative url from sharechat server
// Sample URL - https://gamewall-pwa.sharechat.com/innovation/mother-diary/mother-dairy.html
// {
// "Set-Cookie": "scan-ad=10; Path=scan/adRequest"
// }

var body = { height, width, gaid }
fetch("https://b58c-103-81-94-164.ngrok.io/scan/ad-request",
// fetch("https://run.mocky.io/v3/531e451b-6fd6-4e94-8aa3-e5a8d4f9540b",
{
method: "POST",
headers: {
'content-type': 'application/json',
},
body: JSON.stringify(body),
}
).then(function (res) {
return res.json();
}).then(function (res) {
var creativeUrl = res && res.creativeUrl;
var adIframe = document.createElement('iframe');
adIframe.setAttribute('src', creativeUrl);
adIframe.style.width = width ? `${width}px` : "360px";
adIframe.style.height = height ? `${height}px` : "360px";
parentElm.appendChild(adIframe)
})
})()

Back to list