无法读取未定义的属性“ABD” - Adob​​e Analytics Phonegap插件 [英] Can't read property 'ABD' of the undefined - Adobe Analytics Phonegap Plugin

查看:256
本文介绍了无法读取未定义的属性“ABD” - Adob​​e Analytics Phonegap插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打算使用ADBPhoneGap插件在我的移动应用程序中实现Adobe Analytics。
以下是代码,我正在尝试在 Link
我得到的错误是无法读取未定义的属性'ADB'。如何解决问题。也不能弄清楚在上面的链接中提到的生命周期指标自动跟踪是什么和在哪里实现。任何人都可以参考trackState或trackAction方法的基本脚本,参考以下示例。

Intending to Use the ADBPhoneGap Plugin to implement the Adobe Analytics in my mobile App. Following is the code , i am trying along with the basic configurations asked to do in the Link. The error i am getting is Can't read the Property 'ADB' of the Undefined. How to fix the issue. Also not able to figure out what and where to implement the 'Lifecycle Metrics Auto Tracking' mentioned in the above link. Can anyone help with the basic script for trackState or trackAction method , with reference to the following example .

<!DOCTYPE HTML>
<html>
 <head>
 <!--    <meta name="viewport" content="width=320; user-scalable=no" /> -->
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>PhoneGap</title>
    <link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title">
    <script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
    <script type="text/javascript" charset="utf-8" src="ADB_Helper.js"></script>
    <script type="text/javascript">

    var ADB;
    function initialize() {
    alert('In initalize');
            document.addEventListener("deviceready", onDeviceReady, true);
            //alert('Device Ready');
        alert('Exit initalize');
        }
        function onDeviceReady() {
        alert('in On Device Ready method');
            ADB = window.plugins.ADB;
                        alert('Exit On Device Ready method'+ADB);
            // Note: A request for permission is REQUIRED by google. You probably want to do this just once, though, and remember the answer for subsequent runs.
            navigator.notification.confirm('GA_PLUGIN would like your permission to collect usage data. No personal or user identifiable data will be collected.', permissionCallback, 'Attention', 'Allow,Deny');
        }

    function TrackButtonClicked()
    {
    alert('Track Button Entry');
//  ADB.trackState("login page", {"user":"john","remember":"true"});
    alert('Track Button Exit');
    }
    </script>
   </head>
  <body onload="initialize();"  id="stage" class="theme"> <!-- onunload="goingAway();" -->

<h1>Test Adobe Analytics Plugin</h1>
<div class="space"></div>
<div>
    <a href="#" class="btn large" onclick="TrackButtonClicked();">Track Event</a>
    <!--<a href="#" class="btn large" onclick="VariableButtonClicked();">Track Event with Variable</a>
    <a href="#" class="btn large" onclick="PageButtonClicked();">Track Page</a>-->
 </div>
</body>
</html>


推荐答案

因为在 ADBHelper.js 变量称为 ADB 已经声明,似乎你在代码中覆盖它两次。首先您阴影它与

Since in ADBHelper.js variable called ADB is already declared, it seems that you are overwriting it two times in your code. First you shadow it with the

var ADB

。然后你

ADB = window.plugins.ADB;

这再次设置为 window.plugins.ADB 未定义

因此,删除这两行,之后,如果插件已正确安装,则 ADB 应已经是包含Adobe Analytics 。

So remove this two lines, after that, if the plugin is correctly installed, the ADB should already be object containing the methods for Adobe Analytics.

这篇关于无法读取未定义的属性“ABD” - Adob​​e Analytics Phonegap插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆