gpt4 book ai didi

android - 使用适用于 Android v3 的 Google Analytics SDK

转载 作者:行者123 更新时间:2023-11-29 17:56:35 24 4
gpt4 key购买 nike

我之前使用过 Google Analytics v2,可以使用以下代码发送应用名称、应用版本并设置 anbonimize Ip:

        m_GaTracker.setAnonymizeIp(true);
m_GaTracker.setAppName("MyRemote");
m_GaTracker.setAppVersion(m_appVersion);

其中 m_GaTracker 是 Google Analytics Tracker 的一个实例。

我现在正在迁移到 V3,但此代码不再有效。我收到此错误:

The method setAnonymizeIp(boolean) is undefined for the type Tracker

如何解决这个问题,或者有没有其他方法可以使用 Google Analytics v3 发送这些值?

已检查this但是没用!!

最佳答案

我相信现在您需要使用 set 方法。

Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-XXXX-Y");

// Values set directly on a tracker apply to all subsequent hits.
tracker.set(Fields.ANONYMIZE_IP, true);

https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference 处有一个字段引用. (它是为 analytics.js 编写的,v3 分析旨在与之保持一致。)

您还可以通过反编译 libGoogleAnalyticsServices.jar 来查看字段字符串列表:

public final class Fields
{
public static final String ANONYMIZE_IP = "&aip";
public static final String HIT_TYPE = "&t";
public static final String SESSION_CONTROL = "&sc";
public static final String NON_INTERACTION = "&ni";
public static final String DESCRIPTION = "&cd";
public static final String SCREEN_NAME = "&cd";
public static final String LOCATION = "&dl";
public static final String REFERRER = "&dr";
public static final String PAGE = "&dp";
public static final String HOSTNAME = "&dh";
public static final String TITLE = "&dt";
public static final String LANGUAGE = "&ul";
public static final String ENCODING = "&de";
public static final String SCREEN_COLORS = "&sd";
public static final String SCREEN_RESOLUTION = "&sr";
public static final String VIEWPORT_SIZE = "&vp";
public static final String CLIENT_ID = "&cid";
public static final String CAMPAIGN_NAME = "&cn";
public static final String CAMPAIGN_SOURCE = "&cs";
public static final String CAMPAIGN_MEDIUM = "&cm";
public static final String CAMPAIGN_KEYWORD = "&ck";
public static final String CAMPAIGN_CONTENT = "&cc";
public static final String CAMPAIGN_ID = "&ci";
public static final String EVENT_CATEGORY = "&ec";
public static final String EVENT_ACTION = "&ea";
public static final String EVENT_LABEL = "&el";
public static final String EVENT_VALUE = "&ev";
public static final String SOCIAL_NETWORK = "&sn";
public static final String SOCIAL_ACTION = "&sa";
public static final String SOCIAL_TARGET = "&st";
public static final String TIMING_VAR = "&utv";
public static final String TIMING_VALUE = "&utt";
public static final String TIMING_CATEGORY = "&utc";
public static final String TIMING_LABEL = "&utl";
public static final String APP_NAME = "&an";
public static final String APP_ID = "&aid";
public static final String APP_INSTALLER_ID = "&aiid";
public static final String APP_VERSION = "&av";
public static final String EX_DESCRIPTION = "&exd";
public static final String EX_FATAL = "&exf";
public static final String CURRENCY_CODE = "&cu";
public static final String TRANSACTION_ID = "&ti";
public static final String TRANSACTION_AFFILIATION = "&ta";
public static final String TRANSACTION_SHIPPING = "&ts";
public static final String TRANSACTION_TAX = "&tt";
public static final String TRANSACTION_REVENUE = "&tr";
public static final String ITEM_SKU = "&ic";
public static final String ITEM_NAME = "&in";
public static final String ITEM_CATEGORY = "&iv";
public static final String ITEM_PRICE = "&ip";
public static final String ITEM_QUANTITY = "&iq";
public static final String TRACKING_ID = "&tid";
public static final String SAMPLE_RATE = "&sf";
public static final String JAVA_ENABLED = "&je";
public static final String FLASH_VERSION = "&fl";
public static final String USE_SECURE = "useSecure";
static final String API_VERSION = "&v";
static final String CLIENT_VERSION = "&_v";
static final String USAGE_TRACKING = "&_u";
static final String QUEUE_TIME = "&qt";
static final String HIT_TIME = "&ht";
static final String CACHE_BUSTER = "&z";
static final String GCLID = "&gclid";
static final String DCLID = "&dclid";
static final String GMOB_T = "&gmob_t";
public static final String ANDROID_APP_UID = "AppUID";

用于分析的 android 文档可能会更好。

关于android - 使用适用于 Android v3 的 Google Analytics SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18889619/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com