android - Google Analytics and Dimension/Metrics params -
we developing google analytics android app, have seen can add custom dimension/metrics event doing:
t.send(new hitbuilders.screenviewbuilder() .setcustomdimension(1, "premiumuser") .build() );
but understand that custom dimension sent on event. there way set tracker automatically send events/screens? instance, like:
t.set("cd<1>", "premiumuser");
another question, have add: t.setscreenname(null) in every ondestroy of fragment/activity if sending setscreenname on oncreate method?
thanks in advance
if need screen recorded in analytics, need send screen view on every oncreate
like
t.send(new hitbuilders.appviewbuilder().setcustomdimension(cusdimensionid, dimensionvalue).build());
there no need add t.setscreenname(null)
on ondestroy
get tracker :
public synchronized tracker getcustomdimensiontracker(trackername trackerid) { if (!mcustomdimensiontrackers.containskey(trackerid)) { googleanalytics analytics = googleanalytics.getinstance(this); if (trackerid == trackername.custom_dimension_tracker) { tracker t = analytics.newtracker(app.get().getresources() .getstring(r.string.google_analytics_key)); mcustomdimensiontrackers.put(trackerid, t); } } return mcustomdimensiontrackers.get(trackerid); }
Comments
Post a Comment