///container version 0.1.13 /// ************************* /// ***** Rockstat /// ************************* !function(w, d, st, cn, hs, lj, rst, se, he) { if (w.rstat) return; rst = w.rstat = function() { var a = Array.prototype.slice.call(arguments); a.length && a[0] === cn && rst._a(Object(a[1])); return rst.doCall ? rst.doCall.call(rst, a) : rst._q.push(a) && 0; }; rst._jsl = function(src) { se = d.createElement(st); se.async = !0; se.src = src; he = d.getElementsByTagName(st)[0]; he.parentNode.insertBefore(se, he); }; rst.push = rst; rst._sv = '3.16.0'; rst._q = []; rst._a = function(conf) { rst._host = conf.server; rst._prefix = conf.pathPrefix || ''; rst._host && rst._jsl(hs + rst._host + rst._prefix + lj); } }(window, document, 'script', 'configure', 'https://', '/lib.js'); // --- configuration --- rstat('configure', { server: 'rs.premier.one', //activateWs: true, trackActivity: false }); //rstat('page'); //<<< Send page /// ************************* /// ***** Google Analytics (analytics.js) /// ************************* (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); /// *** Initialize GA ** ga('create', 'UA-66343339-12', 'auto', {'allowLinker': true}); ga('require', 'linker'); ga('linker:autoLink', ['tnt-premier.ru','premier.one']); ga('require', 'ecommerce'); ///ga('send', 'pageview'); ga('set', 'dimension5', 'premier.one'); /// ************************* /// ***** Yandex.Metrika /// ************************* (function(m,e,t,r,i,k,a){ m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; m[i].l=1*new Date(); k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a) }) (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); ym(49768492, "init", { clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true }); /// (new Image()).src = "https://mc.yandex.ru/watch/49768492"; /// ************************* /// ***** Facebook Pixel Code /// ************************* !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '234453417468040'); ///fbq('track', 'PageView'); ///(new Image()).src = "https://www.facebook.com/tr?id=234453417468040&ev=PageView&noscript=1"; /// ************************* /// ***** MyTarget (Rating Mail.ru counter) /// ************************* var _tmr = window._tmr || (window._tmr = []); ///_tmr.push({id: "3179461", type: "pageView", start: (new Date()).getTime()}); ///tmr_t({id: "3179461", type: "pageView", start: (new Date()).getTime()}); (function (d, w, id) { if (d.getElementById(id)) return; var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id; ts.src = "https://top-fwz1.mail.ru/js/code.js"; var f = function () { var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s); }; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "topmailru-code"); window._tmr = window._tmr || []; function tmr_t(params){ window._tmr.push(params); } ///(new Image()).src = "https://top-fwz1.mail.ru/counter?id=3179461;js=na"; /// ************************* /// ***** VK /// ************************* /* var scriptVK = document.createElement("script"); scriptVK.type = "text/javascript"; scriptVK.setAttribute("async", "true"); scriptVK.setAttribute("src", "https://vk.com/js/api/openapi.js?167"); document.documentElement.firstChild.appendChild(scriptVK); window.dataLayer = window.dataLayer || []; function VK(){dataLayer.push(arguments);} VK.Retargeting.Init("VK-RTRG-610228-4NVc1"); VK.Retargeting.Hit(); */ !function(){ var t=document.createElement("script"); t.type="text/javascript",t.async=!0,t.src="https://vk.com/js/api/openapi.js?167",t.onload=function() {VK.Retargeting.Init("VK-RTRG-610228-4NVc1")/*,VK.Retargeting.Hit()*/},document.head.appendChild(t)}(); //(new Image()).src = "https://vk.com/rtrg?p=VK-RTRG-610228-4NVc1"; /// ************************* /// ***** Tik-Tok /// ************************* (function() { var ta = document.createElement('script'); ta.type = 'text/javascript'; ta.async = true; ta.src = 'https://analytics.tiktok.com/i18n/pixel/sdk.js?sdkid=BRVQ8TE7TJFGI7V49CA0'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ta, s); })(); /// ************************* /// ***** GI /// ************************* //(new Image()).src = "https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id=page"; /// ************************* /// ***** Matomo /// ************************* /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ window._paq = window._paq || []; var _paq = window._paq; function matomo_paq(params){ window._paq.push(params); } (function() { var u="https://analytics.zxz.su/"; window._paq.push(['setTrackerUrl', u+'matomo.php']); window._paq.push(['setSiteId', '3']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); matomo_paq(["setCookieDomain", "*.premier.one"]); //matomo_paq(['trackPageView']); matomo_paq(['enableLinkTracking']); // call gpm user sync (function() { function getCookie(name) { let matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } var syncFlag = 'gpm_sync_flag'; var syncValue = 'sync'; if (sessionStorage.getItem(syncFlag) !== syncValue) { var ymCookieName = '_ym_uid'; var ymUid = getCookie(ymCookieName); if (ymUid) { (new Image()).src = 'https://px.adhigh.net/p/cm/gpm?u=' + ymUid + '&source=premier.one'; sessionStorage.setItem(syncFlag, syncValue); } } })(); /// global variables to preserve data for player events /// use `trc_` (TRacking Codes) prefix for global variables var trc_sequence = 0; var trc_pass_id = ''; var trc_profile_id = ''; var trc_content_id = 'content_id'; var trc_video_id = 'video_id'; var trc_local_url_split = []; var trc_inframe_url_split = []; /// *************************** /// ***** EVENTS LISTENER ***** /// *************************** window.addEventListener('message', function(event) { if (!event || !event.data) { return; } var eventData = event.data; var host = eventData.host || null; var type_full = eventData.type || ''; var data = eventData.data || null; var type; if (!eventData || !type_full || !host || host !== 'premier.one' || type_full.substring(0,11) !== 'analytics::' || type_full.length < 12) { // try to parse eventData for player events try { eventData = JSON.parse(eventData); } catch (e) { // data is not a JSON, exit return; } if ( !eventData || typeof eventData.type !== 'string' || eventData.type.substring(0,7) !== 'player:' || !eventData.data || !event.origin.match(/^(((http(s)?:\/\/)?premier.one)|(.+\.zxz\.su))(\/.+|\/|$)/) ) { // not a player event, exit return; } else { if ( eventData.type === 'player:changeState' && !!eventData.data.state && eventData.data.state === 'playing' ) { type = 'player_start_video'; // increment sequence ++trc_sequence; //try add trc_content_id and trc_video_id try { trc_local_url_split = window.location.href.replace('?','/').split('/'); } catch (err_url) { trc_local_url_split = []; } trc_content_id = 'content_id'; trc_video_id = 'video_id'; for (var i = 1; i < trc_local_url_split.length; i++) { if (trc_local_url_split[i-1] === "video") { trc_video_id = trc_local_url_split[i]; } else if (trc_local_url_split[i-1] === "show") { trc_content_id = trc_local_url_split[i]; } } if (trc_video_id === 'video_id') { try { trc_inframe_url_split = window.document.getElementsByClassName('player-uma__video')[0].src.replace('?','/').split('/'); } catch (err_url2) { trc_inframe_url_split = []; } for (var i = 1; i < trc_inframe_url_split.length; i++) { if (trc_inframe_url_split[i-1] === "embed") { trc_video_id = trc_inframe_url_split[i]; } } } data = { pass_id: trc_pass_id, profile_id: trc_profile_id, player: 'uma', sequence: trc_sequence, content_id: trc_content_id, // player don't pass content id, use stub video_id: trc_video_id, // player don't pass video id, use stub }; } else { // skip all player events except video start return; } } } else { type = type_full.substring(11) || ''; /** TEST **/ console.log('event test_json', '\n*******************\n\n\n' + JSON.stringify(event.data, null, 4) +'\n\n\n\n'); } var dataTmp = {}; for (var f in data) { if (f === 'passmedia_id') { dataTmp['pass_id'] = data[f] || ''; } else if (f === 'test_test') { dataTmp['test_test'] = data[f] || ''; } else { dataTmp[f] = data[f] || ''; } } try { switch(type) { case 'page': var mark_page_inside = data['page_inside'] || ''; // save pass_id and profile_id for player events trc_pass_id = dataTmp['pass_id']; trc_profile_id = dataTmp['profile_id']; // reset sequence of 'player_start_video' trc_sequence = 0; if (mark_page_inside === true || mark_page_inside === 'true') { // page_inside rstat('page', dataTmp); ga('send', 'pageview'); // ym(49768492, "init", { // clickmap:true, // trackLinks:true, // accurateTrackBounce:true, // webvisor:true // }); ym(49768492, 'hit', document.URL); fbq('track','PageView'); tmr_t({id: "3179461", type: "pageView", start: (new Date()).getTime()}); VK.Retargeting.Hit(); (new Image()).src = "https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id=page_inside"; matomo_paq(['trackPageView']); } else { // page rstat('page', dataTmp); ga('send', 'pageview'); // ym(49768492, "init", { // clickmap:true, // trackLinks:true, // accurateTrackBounce:true, // webvisor:true // }); fbq('track','PageView'); tmr_t({id: "3179461", type: "pageView", start: (new Date()).getTime()}); VK.Retargeting.Hit(); (new Image()).src = "https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id=page"; matomo_paq(['trackPageView']); } break; case 'login_signin': var registration = dataTmp['registration'] || ''; rstat('event', type, dataTmp); rstat('identify', dataTmp['pass_id'] || '', { pass_id: dataTmp['pass_id'] || '', profile_id: dataTmp['profile_id'] || '', age_id: dataTmp['age_id'] || '' }); if (dataTmp['pass_id'] || '' !== '') { ga('set', 'userId', dataTmp['pass_id']); matomo_paq(['setUserId', dataTmp['pass_id']]); matomo_paq(['trackPageView']); } if (registration === true || registration === 'true') { // Событие РЕГИСТРИЦИЯ ga('send','event','conversion' ,'login' ,'registration'); ym(49768492,'reachGoal','login_registration'); fbq('trackCustom', 'login_registration', { 'event_category': 'profile', 'event_label': 'registration' }); tmr_t({ id: '3179461', type: 'reachGoal', goal: 'login_registration' }); VK.Retargeting.Event('login_registration'); VK.Goal('login_registration'); (new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+'login_registration' matomo_paq(['trackEvent', 'conversion' ,'login' ,'registration']); } else { // Событие ВХОД ga('send','event','conversion','login','signin'); ym(49768492,'reachGoal','login_signin'); fbq('trackCustom', 'login_signin', { 'event_category': 'profile', 'event_label': 'signin' }); tmr_t({ id: '3179461', type: 'reachGoal', goal: 'login_signin' }); VK.Retargeting.Event('login_signin'); VK.Goal('login_signin'); (new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+'login_signin' matomo_paq(['trackEvent', 'conversion' ,'login' ,'signin']); } break; case 'login_signout': rstat('event', type, dataTmp); rstat('identify', '', { pre_pass_id: dataTmp['pass_id'] || '' }); ga('send','event','conversion','login','signout'); ym(49768492,'reachGoal',type); fbq('trackCustom', 'login_signout', { 'event_category': 'profile', 'event_label': 'signout' }); tmr_t({ id: '3179461', type: 'reachGoal', goal: type }); ///VK.Retargeting.Event(type); ///(new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type // Matomo: User has just logged out, we reset the User ID //https://developer.matomo.org/guides/tracking-javascript-guide#user-id //matomo_paq(['resetUserId']); //matomo_paq(['appendToTrackingUrl', 'new_visit=1']); //matomo_paq(['trackPageView']); //matomo_paq(['appendToTrackingUrl', '']); matomo_paq(['trackEvent', 'conversion','login','signout']); break; case 'login_signin_click': rstat('event', type, dataTmp); ga('send','event','profile','login','signin_click'); ym(49768492,'reachGoal',type); fbq('trackCustom', 'login_signin_click', { 'event_category': 'profile', 'event_label': 'signin_click' }); tmr_t({ id: '3179461', type: 'reachGoal', goal: type }); ///VK.Retargeting.Event(type); ///(new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type; matomo_paq(['trackEvent', 'profile','login','signin_click']); break; case 'login_open_pm': rstat('event', type, dataTmp); ga('send','event','profile','login','open_pm'); ym(49768492,'reachGoal',type); fbq('trackCustom', 'login_open_pm', { 'event_category': 'profile', 'event_label': 'open_pm' }); tmr_t({ id: '3179461', type: 'reachGoal', goal: type }); ///VK.Retargeting.Event(type); ///(new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type; matomo_paq(['trackEvent', 'profile','login','open_pm']); break; case 'new_year_2020_trial_openview': rstat('event', type, dataTmp); ga('send','event','profile','banners',type); ym(49768492,'reachGoal',type); ///fbq('trackCustom', 'login_open_pm', { /// 'event_category': 'profile', /// 'event_label': 'open_pm' /// }); ///tmr_t({ id: '3179461', type: 'reachGoal', goal: type }); ///VK.Retargeting.Event(type); ///(new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type; matomo_paq(['trackEvent', 'profile','banners',type]); break; case 'subscription_openview': case 'subscription_startpay': case 'subscription_confirmpay': var sub_id = dataTmp['subscription_id'] || ''; rstat('event', type, dataTmp); ga('send','event','conversion',type, sub_id); ym(49768492,'reachGoal',type); fbq('trackCustom', type, { 'event_category': 'conversion', 'event_label': sub_id }); tmr_t({ id: '3179461', type: 'reachGoal', goal: type }); if (type === 'subscription_confirmpay') { VK.Retargeting.Event(type); VK.Goal(type); } (new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type; matomo_paq(['trackEvent', 'conversion',type, sub_id]); break; case 'profile_startcreate': case 'profile_create': case 'profile_change': rstat('event', type, dataTmp); ga('send','event','profile','settings',type); ym(49768492,'reachGoal',type); fbq('trackCustom', type, { 'event_category': 'profile', 'event_label': 'settings' }); tmr_t({ id: '3179461', type: 'reachGoal', goal: type}); ///VK.Retargeting.Event(type); //(new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type; matomo_paq(['trackEvent', 'profile','settings',type]); break; case 'profile_select': rstat('event', type, dataTmp); rstat('identify', dataTmp['pass_id'] || '', { pass_id: dataTmp['pass_id'] || '', profile_id: dataTmp['profile_id'] || '', age_id: dataTmp['age_id'] || '' }); ga('send','event','profile','settings',type); ym(49768492,'reachGoal',type); fbq('trackCustom', type, { 'event_category': 'profile', 'event_label': 'settings' }); tmr_t({ id: '3179461', type: 'reachGoal', goal: type}); ///VK.Retargeting.Event(type); (new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type; matomo_paq(['trackEvent', 'profile','settings',type]); break; case 'users_active_promocode': case 'active_promocode': var promoType = dataTmp['promo_type'] || ''; rstat('event', type, dataTmp); ga('send','event','conversion','active_promocode',promoType); ym(49768492,'reachGoal',type); fbq('trackCustom', 'users_active_promocode', { 'event_category': 'conversion', 'event_label': promoType }); tmr_t({ id: '3179461', type: 'reachGoal', goal: type}); ///VK.Retargeting.Event(type); (new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+type; matomo_paq(['trackEvent', 'conversion','active_promocode',promoType]); break; case 'player_start_video': var contentID = dataTmp['content_id'] || ''; rstat('event', type, dataTmp); // send all metrics except rstat only for sequence == 1 if (trc_sequence === 1) { ga('send', 'event', 'content', 'play', contentID); ym(49768492, 'reachGoal', type); fbq('trackCustom', 'player_start_video', { 'event_category': 'content', 'event_label': contentID }); tmr_t({id: '3179461', type: 'reachGoal', goal: type}); VK.Retargeting.Event(type); VK.Goal(type); (new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id=' + type; matomo_paq(['trackEvent', 'content', 'play', contentID]); } break; case 'users_leave_appmarket': var store = dataTmp['store'] || ''; rstat('event', type, dataTmp); ga('send','event','product','appmarket',store); ym(49768492,'reachGoal','users_leave_appmarket_'+store); fbq('trackCustom', 'users_leave_appmarket', { 'event_category': 'product', 'event_label': store }); tmr_t({ id: '3179461', type: 'reachGoal', goal: 'users_leave_appmarket_'+store }); ///VK.Retargeting.Event('users_leave_appmarket_'+store); (new Image()).src = 'https://px.adhigh.net/p/tracking.gif?site_id=5938&pixel_id='+'users_leave_appmarket_'+store; matomo_paq(['trackEvent', 'product','appmarket',store]); break; case 'users_favorite_add': case 'users_favorite_delete': case 'users_rating': case 'users_share': rstat('event', type, dataTmp); break; case 'main_page_click_link': case 'impression_item': case 'click_item': rstat('event', type, dataTmp); break; } } catch (error) { console.error('Error occurred while trying send event to analytic systems', error); } });