【问题标题】:Google Mobile Ads SDK App Events with Click Tracking带有点击跟踪的 Google 移动广告 SDK 应用事件
【发布时间】:2013-09-13 07:36:46
【问题描述】:

我们正在使用Google Mobile Ads SDK 在我们的 iOS 和 Android 应用程序中展示一些广告。当用户点击广告并使用 GADAppEventDelegate 获取它们时,我们需要一些参数来进行 Web 服务调用,并且在 Web 服务调用之后我们会呈现一个自定义屏幕。 (所以我们不想将用户重定向到网页)。问题是没有跟踪点击,我们认为广告创意可能配置不正确。

<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 请求服务器。

那么我们如何解决这个问题,跟踪点击而不导航到新网页?

谢谢

【问题讨论】:

    标签: ios google-dfp click-tracking


    【解决方案1】:

    您好,我认为这个答案有点晚了,但您引用的代码确实有效!

    在广告素材 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>
        // 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 控制台中看到点击统计信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-24
      • 2014-10-14
      • 1970-01-01
      • 2010-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多