async function daoNativeExec(url, p = {}, utm = {}) {
//	return false;
    p = {
        container: p.container || "#daoNativeTagAd",
        link: p.link || false,
        imgSrc: p.imgSrc !== undefined ? p.imgSrc : "https://lcdn.tsyndicate.com/images/4/1/39fd3788e5d7968c01479ebc0df35787951e99.jpg",
        isEmpty: p.isEmpty || true,
        width: p.width || 300,
        height: p.height || 250,
        onClickContainer: p.onClickContainer || false,
        backfix: p.backfix || false,
        openerTimeout: p.openerTimeout || 0,
        cntAds: p.cntAds || 1,
        cntCols: p.cntCols || 1,
    };
    utm = {
        utm_source: utm.utm_source || null,
        utm_medium: utm.utm_medium || null,
        utm_campaign: utm.utm_campaign || null,
        utm_term: utm.utm_term || null,
        utm_content: utm.utm_content || null,
    };

    try {
        const resp = await fetch(url, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json; charset=UTF-8'
            },
            credentials: "include",
            body: JSON.stringify({
                page: window.location.href,
                tz: null,
                tzOffset: null,
                userId: window.localStorage.getItem('d-nt-uid'),
                version: 2,
                marks: utm,
                addVars: {},
//                count: p.cntAds,
		    count:{s51601p1515: 1},
		    context:{s51601p1515: null},
		    place:{s51601p1515: null},
placeId:["s51601p1515"],
		    deviceHeight:915,
deviceWidth:412,
imageRatio:{s51601p1515: 1.333333},
imageSize:{s51601p1515: {width: 1013.76, height: 760.32}},
itemFormat:{s51601p1515: "default"},
lang:"ru-RU",
		    tagId:{},
tz:"Europe/Moscow",
tzOffset:180
//                cols: p.cntCols
            })
        });
        const pp = await resp.json();
//console.log(pp);
        if (!pp.items || !pp.items['s51601p1515']) {console.log("DaoNativeTag FALSE: " + p.container);return false;}
        const items = pp.items['s51601p1515'];

        let isError = false;
        const arr = [];
        const pixels = [];
        items.forEach((el) => {
            if (!isError) {
                if (!el.url) {
                    isError = true;
                    console.log("DaoNativeTag with URL FALSE: " + p.container);
                } else {
                    arr.push({href: el.url, image: el.image, text: el.text, title: el.title, pixels: el.pixels});
                    el.pixels.forEach((pixel) => {
                        pixels.push(pixel)
                    });
                }
            }
        });

        if (isError) return false;
        
        pixels.forEach(function(pixel) {
            fetch(pixel, {method: 'GET', mode: 'no-cors', credentials: 'include'});
        });

        const rand = Math.floor(Math.random() * arr.length);
        const clickedEl = arr.at(rand) !== undefined ? arr.at(rand) : null;

        if (p.onClickContainer && clickedEl !== null) {
            $(p.onClickContainer).click(()=>{
                window.open(clickedEl.href);
            });
            return true;
        }

        if (p.backfix && clickedEl !== null) {
            let _bfl = clickedEl.href;
            !function(){let t;try{for(t=0;10>t;++t)history.pushState({},"","#");onpopstate=function(t){exit=true;
                setTimeout(()=>{t.state && location.replace((typeof(_bfl)=='string'&&_bfl!='')?_bfl:"#");}, 300);
            }}catch(o){}}();
            return true;
        }

        if (p.isEmpty) {
            $(p.container).empty();
            p.isEmpty = false;
        }

        if (clickedEl !== null && !(p.link && $(p.link).is("a"))) {
            let src = clickedEl.image;
            if (ext(src) == "mp4" || ext(src) == "m4v" || ext(src) == "mpg" || ext(src) == "avi" || ext(src) == "webm" || ext(src) == "ogg") {
                $(p.container).append('<a href="' + clickedEl.href + '" target="_blank" rel="nofollow noopener"><video width="'+p.width+'" height="'+p.height+'" muted autoplay="autoplay"><source src="'+src+'" type="video/mp4"></video></a>');
            } else {
                $(p.container).append('<a href="' + clickedEl.href + '" target="_blank" rel="nofollow noopener"><img src="' + src + '" style="width:'+p.width+'px;height:'+p.height+'px;" /></a>');
            }

            $("a", p.container).click(function() {
            });
        }

        if (p.link && $(p.link).is("a") && clickedEl !== null) {
            $(p.link).attr('href', clickedEl.href);
            $(p.link).attr('target', '_blank');
            $(p.link).click(function() {
            });
        }

        if (p.openerTimeout > 0 && clickedEl !== null) console.log("Timeout: " + p.openerTimeout);
        if (p.openerTimeout > 0 && window.opener && clickedEl !== null) {
            if (p.openerTimeout < 10) {
                window.opener.location.href = clickedEl.href;
            } else {
                setTimeout(()=>{
                    window.opener.location.href = clickedEl.href;
                },p.openerTimeout);
            }
        }

        return clickedEl !== null ? clickedEl.href : true;
    } catch(e) {
//        console.log(e);
        return false;
    }
}
