我们正在使用Google Mobile Ads SDK在我们的iOS和安卓应用程序中显示一些广告。我们需要一些参数来进行web服务调用,当用户单击广告时,我们使用GADAppEventDelegate获取它们,在web服务调用之后,我们显示一个自定义屏幕。(所以我们不想将用户重定向到Web页面)。问题是没有跟踪点击,我们认为Ad Creative可能没有正确配置。
<html><body leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
<html>
<head>
<script src="http://media.admob.com/api/v1/google_mobile_app_ads.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
function fireEvent() {
admob.events.dispatchAppEvent("query_string", "ad_origin_key=USPS2013_iPhone_Upgraded_320x50&k_key=&acid_key=719768856&ad_image_url_key=http://USPS2013_iphone_320x50");
}
</script>
</head>
<body>
<img src="http://pagead2.googlesyndication.com/pagead/imgad?id=CICAgIDQ59KwChABGAEyCKGNWPM-wPBl" width="320" height="50" border="0" onclick="fireEvent()"/>
</body>
</html></body></html>我认为,为了不被重定向到网页,我们应该在fireEvent()函数中发出AJAX请求,类似于$.get("%%CLICK_URL_UNESC%%www.example.com/ads/landingpage");,但是浏览器不允许AJAX请求发送到不同于原始请求服务器的服务器。
那么,我们如何解决这个问题,跟踪点击,而不是导航到新的网页?
谢谢
发布于 2014-07-08 17:28:50
你好,我认为这个答案有点晚了,但你引用的代码实际上是有效的!!
在你的头标签内的HTML的创意
<script src="http://media.admob.com/api/v1/google_mobile_app_ads.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
// Send an event when ad loads.
// admob.events.dispatchAppEvent("adId", "1");
// handle your click with onClick="handleClick()"
handleClick = function() {
admob.log("click ad: call handleClick()"); // call a log to XCode console for debug
// Send an event when ad is clicked.
admob.events.dispatchAppEvent("eventName", "params"); //{action}|{action params}...
//magic goes here
//i think the click measure through this url
//and use jQuery get that send get method without callbacks
$.get("%%CLICK_URL_UNESC%%")
};
</script>您必须等待一段时间,比如30分钟,然后您将在DFP控制台中看到点击统计数据。
https://stackoverflow.com/questions/18780784
复制相似问题