I've been trying to implement Enhanced Ecommerce Tracking, but no matter what I do the Ecommerce View in Google Analytcs web panel stays empty, i.e. no data is sent (apparently). All other data, Screen and Event tracking works as expected.
I'm following the official guides on installing google analytics and on implementing Enhanced Ecommerce tracking. Here are my settings:
in MyApplication class:
public class MyApplication extends Application {
private Tracker mTracker;
//....
synchronized public Tracker getDefaultTracker() {
if (mTracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
mTracker = analytics.newTracker(R.xml.global_tracker);
mTracker.set("&tid", GOOGLE_ANALYTICS_ID_VALUE);
}
return mTracker;
}
}
the R.xml.global_tracker:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="ga_sessionTimeout">300</integer>
<bool name="ga_autoActivityTracking">false</bool>
<string name="ga_sampleFrequency">100.0</string>
<bool name="ga_reportUncaughtExceptions">true</bool>
<integer name="ga_dispatchPeriod">30</integer>
</resources>
in BaseActivity class I have the trackEcommerce() method which I use in appropriate Activities/Fragments:
public void trackEcommerce(){
String screenName = "eCommerce";
String transactionID = "transactionID"; //some randomized value
Double transactionRevenue = 0.0; //value of the transaction
Tracker t = ((MyApplication) getApplication()).getDefaultTracker();
//send products
for (MyEcommerceItem item : myEcommerceItems) {
Product product = new Product()
.setId(item.getSku())
.setName(item.getTitle())
.setCategory(item.getType())
.setPrice(item.getPrice())
.setQuantity(item.getQuantity());
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder().addProduct(product);
t.setScreenName(screenName);
t.send(builder.build());
}
//send transaction
ProductAction productAction = new ProductAction(ProductAction.ACTION_CHECKOUT)
.setTransactionId(transactionID)
.setTransactionRevenue(transactionRevenue);
HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder().setProductAction(productAction);
t.setScreenName(screenName);
t.send(builder.build());
}
The obvious question, can you see something that I'm doing wrong/some ideas on what I need to change?