Google tag manager won't push event's to datalayer on Android -
i'm trying implement tag manager in android application following this guide, reason can't push event's datalayer.
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); tagmanager tagmanager = tagmanager.getinstance(getapplicationcontext()); tagmanager.getinstance(getapplicationcontext()).setverboseloggingenabled(true); pendingresult<containerholder> pending = tagmanager.loadcontainerpreferfresh(google_tag_manager_container_id, r.raw.gtm_default_container_v2); pending.setresultcallback(new resultcallback<containerholder>() { @override public void onresult(containerholder containerholder) { tagmanager.getinstance(getapplicationcontext()).getdatalayer().push("event", "screenname"); // using "pushevent" method doesn't work either // tagmanager.getinstance(getapplicationcontext()).getdatalayer().pushevent("screenname", datalayer.mapof()); } }, 2, timeunit.seconds); }
when try run app, log saying this
v/googletagmanager﹕ attempting load container resource id 2131099649 (com.example.cpe.gatestapp:raw/gtm_default_container_v2) v/googletagmanager﹕ deleted 0 expired items w/googletagmanager﹕ failed extract container resource file. resource utf-8 encoded string doesn't contain json container v/googletagmanager﹕ container loaded resource (using binary file) e/googletagmanager﹕ invalid macro: _gtm.loadeventenabled v/googletagmanager﹕ attempting load resource disk v/googletagmanager﹕ loadafterdelay: containerid=gtm-xxxxxx delay=0 d/googletagmanager﹕ setting previous container version: mq$0 e/googletagmanager﹕ invalid macro: _gtm.loadeventenabled v/googletagmanager﹕ disk resource read. v/googletagmanager﹕ start loading resource network ... v/googletagmanager﹕ loaded supplemented resource: zzi_p: "mq$0" v/googletagmanager﹕ no change container: gtm-xxxxxx v/googletagmanager﹕ loadafterdelay: containerid=gtm-xxxxxx delay=43200000 d/googletagmanager﹕ setting previous container version: mq$0 e/googletagmanager﹕ invalid macro: _gtm.loadeventenabled v/googletagmanager﹕ setting refresh time current time: 1435818825632 v/googletagmanager﹕ load resource network finished.
screenshots ga , tag manager accounts:
the answer question pretty simple after figured out.
so have created analytics tracker track's if application crashes. have made option, if i'm running application in debug mode aka running androidstudio, tracker make 'dryrun'.
so figured tagmanager using analytics tracker send events. why helped disable dryrun on googleanalytics tracker.
Comments
Post a Comment