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.
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.
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.
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.
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With