Отслеживание кликов осуществляется путём вызова следующего кода, где параметр — это адрес отслеживания от третьей стороны:
[[MobileTracking sharedInstance] click:@"http://example.com/xxxxxx"];
Используется для сохранения текущих данных отслеживания, чтобы они не были потеряны. Рекомендуется размещать в методе applicationDidEnterBackground класса AppDelegate.
[[MobileTracking sharedInstance] didEnterBackground];
Повторно считывает данные из кэша. Используется для обеспечения своевременной отправки текущих данных отслеживания. Рекомендуется размещать в методе applicationWillEnterForeground класса AppDelegate.
[[MobileTracking sharedInstance] didEnterForeground];
Сохраняет текущие данные отслеживания, чтобы предотвратить их потерю.
[[MobileTracking sharedInstance] willTerminate];
Рекомендуется включать во время тестирования.
[[MobileTracking sharedInstance] enableLog:YES];
Тестирование SDK включает два аспекта:
Для завершения тестирования необходимо связаться с третьей стороной, отвечающей за отслеживание.
Подключение к странице материалов веб-просмотра (вариант 2)
Использование: применяется метод без внедрения, требуется предварительно внедрить фрагмент кода JS SDK. SDK по умолчанию активно отслеживает состояние элементов BTR на странице рекламы, если вы хотите точно отслеживать определённый рекламный материал, просто добавьте класс umid-element
к соответствующему тегу элемента.
Пример кода:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- js sdk 代码放入 head 元素内 -->
<script>
!function(){"use strict";var e=function(e){return JSON.stringify(e)},t=function(e){var t=e.getBoundingClientRect();return 0==t.width||0==t.height};var n,i,s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},o=[],r=new window.Map,a=function(e){var t;navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)?window.webkit.messageHandlers.__mz_Monitor.postMessage(e):((t=navigator.userAgent).indexOf("Android")>-1||t.indexOf("Adr")>-1)&&window.__mz_Monitor.mz_push(e)};!function(e){e.JavaScript="javaScript",e.Image="image",e.Video="video",e.AUDIO="audio",e.HTML="html"}(n||(n={})),!function(e){e.Impression="impression",e.ImpressionError="impressionError",e.WindowUnload="unload",e.Click="click",e.DisplayChange="displayChange",e.Start="start",e.FirstQuartile="firstQuartile",e.Midpoint="midpoint",e.ThirdQuartile="thirdQuartile",e.Complete="complete",e.Pause="pause",e.Resume="resume",e.BufferStart="bufferStart",e.BufferFinish="bufferFinish"}(i||(i={}));var d=function(){function e(e){this.advertisementType=n.Image,this.el=e,this.onError=this.onError.bind(this),this.onLoad=this.onLoad.bind(this),this.bindEvent(),this.checkVisible()}return e.prototype.checkVisible=function(){this.el.complete&&(t(this.el)?this.onError():this.imageComplete())},e.prototype.imageComplete=function(){var e=new Image;e.src=this.el.src,e.onload=this.onLoad,e.onerror=this.onError},e.prototype.bindEvent=function(){this.el.addEventListener("error",this.onError),this.el.addEventListener("load",this.onLoad)},e.prototype.send=function(e){d(s(s({},e),{advertisementType:this.advertisementType}))},e.prototype.onImpression=function(){this.send({eventType:i.Impression,ImpressionType:"beginToRender",isRender:"1"})},e.prototype.onError=function(){this.send({eventType:i.ImpressionError,ImpressionType:"beginToRender",isRender:"0"})},e.prototype.onLoad=function(){this.onImpression()},e.prototype.onClick=function(){},e.prototype.destroyed=function(){this.el.removeEventListener("error",this.onError),this.el.removeEventListener("load",this.onLoad),this.el=null},e}(),h=function(){function e(e){this.advertisementType=n.AUDIO,this.quartileEvents={"1q":!1,"2q":!1,"3q":!1,"4q":!1},this.isFirst=!1,this.isFullscreen=!1,this.el=e,this.isFirst=!0,this.onPlay=this.onPlay.bind(this),this.onPause=this.onPause.bind(this),this.onWaiting=this.onWaiting.bind(this),this.onTimeupdate=this.onTimeupdate.bind(this),this.onWebkitendfullscreen=this.onWebkitendfullscreen.bind(this),this.onWebkitbeginfullscreen=this.onWebkitbeginfullscreen.bind(this),this.bindEvent(),this.checkElement()}
``` Вот перевод текста на русский язык:
e.prototype.checkElement = function() { t(this.el)? this.beforeImpression(!1): this.beforeImpression(!0) }, e.prototype.bindEvent = function() { this.el.addEventListener("play", this.onPlay), this.el.addEventListener("pause", this.onPause), this.el.addEventListener("waiting", this.onWaiting), this.el.addEventListener("timeupdate", this.onTimeupdate), this.el.addEventListener("webkitendfullscreen", this.onWebkitendfullscreen), this.el.addEventListener("webkitbeginfullscreen", this.onWebkitbeginfullscreen) }, e.prototype.onPlay = function() { this.isFirst? this.isFirst=!1: this.send({EventType: i.Resume}) }, e.prototype.onPause = function() { this.send({eventType: i.Pause}) }, e.prototype.onWaiting = function() {}, e.prototype.onTimeupdate = function() {}, e.prototype.onVolumechange = function() {}, e.prototype.onWebkitendfullscreen = function() { this.isFullscreen=!1 }, e.prototype.onWebkitbeginfullscreen = function() { this.isFullscreen=!0 }, e.prototype.send = function(e) { d(s(s({}, e), {advertisementType: this.advertisementType, quartileEvents: this.quartileEvents})) }, e.prototype.beforeImpression = function(e) { this.send({EventType: i.Impression, ImpressionType:"beginToRender", isRender: e?"1":"0"}) }, e.prototype.destroyed = function() { this.el.removeEventListener("play", this.onPlay), this.el.removeEventListener("pause", this.onPause), this.el.removeEventListener("waiting", this.onWaiting), this.el.removeEventListener("timeupdate", this.onTimeupdate), this.el.removeEventListener("webkitendfullscreen", this.onWebkitendfullscreen), this.el.removeEventListener("webkitbeginfullscreen", this.onWebkitbeginfullscreen), this.el=null }, e}(), l=function() { function e() { this.advertisementType=n.HTML, document.body.innerText.length>0? this.send({isRender:"1"}): this.send({isRender:"0"}) } return e.prototype.send=function(e){ d(s(s({},e),{advertisementType:this.advertisementType,ImpressionType:"beginToRender"})) }, e }(); var p, c, f=function(){ var e, t=document.body.querySelector(".umid-element"); if (t) return (e=t).tagName&&"video"===e.tagName.toLowerCase()? new u(t): function(e){return e.tagName&&"img"===e.tagName.toLowerCase()(t)? new h(t): new l; var n=document.body.querySelector("video"); if(n)return new u(n); var i=document.body.querySelectorAll("img"); if(i.length){ var s=function(e){for(var t=0,n=null,i=0;i<e.length;i++){var s=e[i],o=s.offsetWidth*s.offsetHeight;o>=t&&(t=o,n=s)}return n}(i); return new h(s) }return new l }; function m(){f()} if (document.body) m(); else { var v=(p=function(){m()},c=!1,function(){c||(c=!0,p.apply(this,arguments))}); window.addEventListener("load",v), document.addEventListener("DOMContentLoaded",v) }}, u=function(){}, h=function(){};
Обратите внимание, что в тексте запроса есть фрагменты кода, которые не удалось перевести из-за отсутствия контекста.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )