Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics - Tracking Unknown

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.

like image 538
Vinayak Bevinakatti Avatar asked Nov 08 '10 14:11

Vinayak Bevinakatti


People also ask

Why is Google Analytics trying to track me?

Google uses personal data from Google Analytics, Global Site Tag, and from their many other trackers and products, so they can target you with advertising and content they think you'll want to see.

Why is no data showing up in Google Analytics?

You've turned on the User-ID feature in your view settings but haven't configured it. User-ID tracking needs an additional code implementation and if it's not done, your Google Analytics view will contain no data.

Are Google Analytics anonymous?

Analytics provides the anonymize_ip feature ( gtag('config', '<GA_MEASUREMENT_ID>', { 'anonymize_ip': true }) in the gtag. js library) to allow website owners to request that all of their users' IP addresses are anonymized within the product.


1 Answers

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();
like image 74
Eric Nordvik Avatar answered Sep 28 '22 05:09

Eric Nordvik