为什么我没有关于GA视图的任何数据? 编译'com.google.android.gms:play-services-location:9.4.0'
所有书写/复制,如手册(https://developers.google.com/tag-manager/android/v4/)
void tagManagerInit() {
tagManager = TagManager.getInstance(this);
tagManager.setVerboseLoggingEnabled(true);
PendingResult<ContainerHolder> pending =
tagManager.loadContainerPreferNonDefault(CONTAINER_ID,
R.raw.gtm_xxxxx);
pending.setResultCallback(new ResultCallback<ContainerHolder>() {
@Override
public void onResult(ContainerHolder containerHolder) {
ContainerHolderSingleton.setContainerHolder(containerHolder);
Container container = containerHolder.getContainer();
if (!containerHolder.getStatus().isSuccess()) {
Log.e("CuteAnimals", "failure loading container");
return;
}
ContainerLoadedCallback.registerCallbacksForContainer(container);
containerHolder.setContainerAvailableListener(new ContainerLoadedCallback());
tagManagerFill();
}
}, TIMEOUT_FOR_CONTAINER_OPEN_MILLISECONDS, TimeUnit.MILLISECONDS);
}
我的标签:
选择产品
GA
配置标记
标签类型
通用分析
跟踪ID
UA-XXXXXXXXX-X
启用广告ID功能
真
轨道类型
App View
开火 任何事件
以上fillData一些推送事件(copypast + random):
void tagManagerFill() {
Log.v("GoogleTagManager", "startFill");
DataLayer dataLayer = tagManager.getDataLayer();
dataLayer.push(DataLayer.mapOf("event", "transaction",
"transactionId", 1,
"transactionTotal", 2,
"transactionAffiliation", "In-app",
"transactionTax", 4,
"transactionShipping", 5,
"transactionCurrency", "USD",
"transactionProducts", 6));
dataLayer.push(DataLayer.mapOf("event", "openScreen", "screenName", "eyrtyertyert456734yrtyerty"));
dataLayer.pushEvent("OpenScreen", DataLayer.mapOf("screenName", "354235"));
....
logcat的:
I/GoogleTagManager: Obtained fresh AdvertisingId info from GmsCore.
W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
I/GoogleTagManager: Tag Manager initilization took 83ms
V/GoogleTagManager: Attempting to load a container from the resource ID 2131165184 (<<pck_name>>:raw/gmt_<<xxxx>>)
V/GoogleTagManager: Deleted 0 expired items
W/GoogleTagManager: Failed to extract the container from the resource file. Resource is a UTF-8 encoded string but doesn't contain a JSON container
V/GoogleTagManager: The container was successfully loaded from the resource (using binary file)
E/GoogleTagManager: Invalid macro: _gtm.loadEventEnabled
V/GoogleTagManager: Attempting to load resource from disk
V/GoogleTagManager: loadAfterDelay: containerId=GTM-<<ID>> delay=35716824
D/GoogleTagManager: Setting previous container version: NQ$0
E/GoogleTagManager: Invalid macro: _gtm.loadEventEnabled
V/GoogleTagManager: The Disk resource was successfully read.
I/GoogleTagManager: Obtained fresh AdvertisingId info from GmsCore.
W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
I/GoogleTagManager: Tag Manager initilization took 53ms
答案 0 :(得分:1)
您是否在要设置的字段中提供screenName? Universal Analytics代码需要screenName才能跟踪appView类型。