Google Analytics - 跟踪未知

发布于 2024-09-30 18:54:34 字数 2231 浏览 3 评论 0原文

我已经按照适用于 Android 的 Google Analytics SDK 文档<中的指示创建了一个测试 Google Analytics 示例应用程序< /a> 并且我已经使用以下方式在我的代码中启动了跟踪:

tracker = GoogleAnalyticsTracker.getInstance();
tracker.trackEvent(
            "Clicks",  // Category
            "Button",  // Action
            "clicked", // Label
            77);  

并且

tracker.trackPageView("/HomeScreen");
tracker.dispatch();

我已经创建了一个 Google Analytics 帐户,如果转到 Analytics 设置选项卡,则在我的帐户中。我的状态为“跟踪未知”

我尝试单击编辑并单击检查状态,然后我也得到“跟踪未安装”

供参考 我的代码是:

public class GAnalytics extends Activity {

  GoogleAnalyticsTracker tracker;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.start("UA-19487404-1",20, this);

    setContentView(R.layout.main);
    Button createEventButton = (Button)findViewById(R.id.NewEventButton);
    createEventButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        tracker.trackEvent(
            "Clicks",  // Category
            "Button",  // Action
            "clicked", // Label
            77);       // Value
      }
    });

    Button createPageButton = (Button)findViewById(R.id.NewPageButton);
    createPageButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        tracker.trackPageView("/HomeScreen");
      }
    });

    Button quitButton = (Button)findViewById(R.id.QuitButton);
    quitButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        finish();
      }
    });

    Button dispatchButton = (Button)findViewById(R.id.DispatchButton);
    dispatchButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        tracker.dispatch();
      }
    });
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    super.onDestroy();
    tracker.dispatch();
    tracker.stop();
  }
}

请指出我在哪里做错事。

I have created a testing Google Analytics sample app as directed in on Google Analytics SDK for Android documentation and I have initiated Tracking in my code using:

tracker = GoogleAnalyticsTracker.getInstance();
tracker.trackEvent(
            "Clicks",  // Category
            "Button",  // Action
            "clicked", // Label
            77);  

And

tracker.trackPageView("/HomeScreen");
tracker.dispatch();

I have created a Google Analytics account, In my account if go to Analytics setting tab. I am getting the status as "Tracking Unknown"

I tried clicking on the edit and clicked check status, Then too I am Getting "Tracking Not Installed"

For Reference My code is:

public class GAnalytics extends Activity {

  GoogleAnalyticsTracker tracker;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.start("UA-19487404-1",20, this);

    setContentView(R.layout.main);
    Button createEventButton = (Button)findViewById(R.id.NewEventButton);
    createEventButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        tracker.trackEvent(
            "Clicks",  // Category
            "Button",  // Action
            "clicked", // Label
            77);       // Value
      }
    });

    Button createPageButton = (Button)findViewById(R.id.NewPageButton);
    createPageButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        tracker.trackPageView("/HomeScreen");
      }
    });

    Button quitButton = (Button)findViewById(R.id.QuitButton);
    quitButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        finish();
      }
    });

    Button dispatchButton = (Button)findViewById(R.id.DispatchButton);
    dispatchButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
        tracker.dispatch();
      }
    });
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    super.onDestroy();
    tracker.dispatch();
    tracker.stop();
  }
}

Please point me where I am doing wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

分开我的手 2024-10-07 18:54:34

您在调用 .getInstance() 后是否启动了跟踪器?
像这样:

tracker.start("UA-YOUR-ACCOUNT-HERE", this);

您还需要调用以下命令将数据发送到Google Analytics:

tracker.dispatch();

Have you started the tracker after your call to .getInstance()?
Like this:

tracker.start("UA-YOUR-ACCOUNT-HERE", this);

You also need to call the following to send the data to Google Analytics:

tracker.dispatch();
生生漫 2024-10-07 18:54:34

默认情况下,分析数据晚一天,您是否修改报告日期以显示当天?如果是这样,请记住,延迟 30 分钟并不罕见。

By default, analytics data is one day behind, are you modifying the reporting dates to show the current day? If so, bear in mind that a 30 minute delay is not at all unusual.

谁人与我共长歌 2024-10-07 18:54:34

参考下面的代码

public class TestActivity extends Activity {

   GoogleAnalyticsTracker tracker;


      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        tracker = GoogleAnalyticsTracker.getInstance();

        // Start the tracker in manual dispatch mode...
        tracker.startNewSession("UA-33332745-1", this);

        setContentView(R.layout.main);
        Button createEventButton = (Button)findViewById(R.id.NewEventButton);
        createEventButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {
            tracker.trackEvent(
                "Clicks",  // Category
                "Button",  // Action
                "clicked", // Label
                77);       // Value
          }
        });

        Button createPageButton = (Button)findViewById(R.id.NewPageButton);
        createPageButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {       
            // Add a Custom Variable to this pageview, with name of "Medium" and value "MobileApp"
            tracker.setCustomVar(1, "Medium", "Mobile App");        
            tracker.trackPageView("/testApplicationHomeScreen");
          }
        });

        Button quitButton = (Button)findViewById(R.id.QuitButton);
        quitButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {
            finish();
          }
        });

        Button dispatchButton = (Button)findViewById(R.id.DispatchButton);
        dispatchButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {
            tracker.dispatch();
          }
        });
      }


      protected void onDestroy() {
        super.onDestroy();
        // Stop the tracker when it is no longer needed.
        tracker.stopSession();
      }
    }

Refer below code

public class TestActivity extends Activity {

   GoogleAnalyticsTracker tracker;


      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        tracker = GoogleAnalyticsTracker.getInstance();

        // Start the tracker in manual dispatch mode...
        tracker.startNewSession("UA-33332745-1", this);

        setContentView(R.layout.main);
        Button createEventButton = (Button)findViewById(R.id.NewEventButton);
        createEventButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {
            tracker.trackEvent(
                "Clicks",  // Category
                "Button",  // Action
                "clicked", // Label
                77);       // Value
          }
        });

        Button createPageButton = (Button)findViewById(R.id.NewPageButton);
        createPageButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {       
            // Add a Custom Variable to this pageview, with name of "Medium" and value "MobileApp"
            tracker.setCustomVar(1, "Medium", "Mobile App");        
            tracker.trackPageView("/testApplicationHomeScreen");
          }
        });

        Button quitButton = (Button)findViewById(R.id.QuitButton);
        quitButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {
            finish();
          }
        });

        Button dispatchButton = (Button)findViewById(R.id.DispatchButton);
        dispatchButton.setOnClickListener(new OnClickListener() {

          public void onClick(View v) {
            tracker.dispatch();
          }
        });
      }


      protected void onDestroy() {
        super.onDestroy();
        // Stop the tracker when it is no longer needed.
        tracker.stopSession();
      }
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文