我使用以下代码来实现GTM
初始化GTM
public void initializeGTM(Context context) {
//GTM setup
tagManager = TagManager.getInstance(context);
// Modify the log level of the logger to print out not only
// warning and error messages, but also verbose, debug, info messages.
tagManager.setVerboseLoggingEnabled(true);
PendingResult<ContainerHolder> pending = tagManager.loadContainerPreferNonDefault(GTM_CONTAINER_ID, R.raw.gtm_k4cqpb_v13);
// The onResult method will be called as soon as one of the following happens:
// 1. a saved container is loaded
// 2. if there is no saved container, a network container is loaded
// 3. the request times out. The example below uses a constant to manage the timeout period.
pending.setResultCallback(new ResultCallback<ContainerHolder>() {
@Override
public void onResult(ContainerHolder containerHolder) {
ContainerHolderSingleton.setContainerHolder(containerHolder);
containerHolder.getContainer();
if (!containerHolder.getStatus().isSuccess()) {
/**
* TODO
* remove condition and logs after GTM testing
*/
if (DEBUG)
Log.e(GTM_LOG_TAG, String.valueOf(R.string.gtm_container_load_error));
return;
}
ContainerHolderSingleton.setContainerHolder(containerHolder);
}
}, GTM_TIMEOUT, TimeUnit.SECONDS);
mAnalytics = GoogleAnalytics.getInstance(context);
mAnalytics.setLocalDispatchPeriod(1800);
mTracker = mAnalytics.newTracker(TRACKER_ID); // Replace with actual tracker id
}
我使用mTracker只记录屏幕名称
if (mTracker != null) {
mTracker.setScreenName(fullName.toString());
mTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
以及我正在使用DataLayer对象的其他datapush和dataevents
我正在努力解决的主要问题是,在GA报告中,当我使用 应用版本辅助维度 进行过滤时,
我已经使用Charles代理跟踪了GA请求,在GA中我可以看到versionName以及变量&#34; av&#34;
下的versionCode值在我疯狂的时候请帮忙,现在我能想到的所有选项都没有。
由于