android - Sending key-value pairs payload to Google Analytics -
i'm trying send n amount of custom key-value pairs attached single hit. hit have own key category/action/label, i'm after defining own keys.
i'm trying integrate google analytics application. i've followed configuration steps , works, i'm trying understand how event reporting works, , how can send own custom events off predefined key-value pairs.
map<string, string> mymap = new hashmap<>(); mymap.put("hello", "world"); mymap.put("liek", "turtles"); googleanalytics analytics = googleanalytics.getinstance(context); analytics.setlocaldispatchperiod(1800); tracker tracker = analytics.newtracker(token); tracker.send(mymap);
which unwelcomely received logcat error.
w/gav4﹕ discarding hit. missing hit type parameter: tid=world, a=504324093
i'm experimenting other apis hitbuilders , set(), none provides clear key-value pair mapping.
i think looking custom dimensions. first should create custom dimension , send screen/event hit.
using example, should use this:
// tracker. tracker t = ((analyticssampleapp) getactivity().getapplication()).gettracker(trackername.app_tracker); t.setscreen("home screen"); // send custom dimension value screen view. // note value needs sent once. t.send(new hitbuilders.screenviewbuilder() .setcustomdimension(1, "world") .setcustomdimension(2, "turtles") .build() );
where dimension #1 configured "hello dimension" , dimension #2 "liek dimension". example on screen view, same accomplished event.
Comments
Post a Comment