本文整理汇总了Java中com.google.analytics.tracking.android.Tracker类的典型用法代码示例。如果您正苦于以下问题:Java Tracker类的具体用法?Java Tracker怎么用?Java Tracker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tracker类属于com.google.analytics.tracking.android包,在下文中一共展示了Tracker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTracker
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
private static Tracker getTracker(){
if(sTracker==null){
sTracker = GoogleAnalytics.getInstance(sInstance).getTracker(BuildConfig.GoogleAnalytics_KEY);
ExceptionReporter handler = new ExceptionReporter(
sTracker, // Currently used Tracker.
GAServiceManager.getInstance(), // GAServiceManager singleton.
Thread.getDefaultUncaughtExceptionHandler(),
sInstance); // Current default uncaught exception handler.
// Make handler the new default uncaught exception handler for main(GUI) thread.
Thread.setDefaultUncaughtExceptionHandler(handler);
}
return sTracker;
}
示例2: trackView
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
private void trackView(String screenname, CallbackContext callbackContext) {
if (! trackerStarted ) {
callbackContext.error("Tracker not started");
return;
}
Tracker tracker = GoogleAnalytics.getInstance(this.cordova.getActivity()).getDefaultTracker();
addCustomDimensionsToTracker(tracker);
if (null != screenname && screenname.length() > 0) {
tracker.set(Fields.SCREEN_NAME, screenname);
tracker.send(MapBuilder
.createAppView()
.build()
);
callbackContext.success("Track Screen: " + screenname);
} else {
callbackContext.error("Expected one non-empty string argument.");
}
}
示例3: trackEvent
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
private void trackEvent(String category, String action, String label, long value, CallbackContext callbackContext) {
if (! trackerStarted ) {
callbackContext.error("Tracker not started");
return;
}
Tracker tracker = GoogleAnalytics.getInstance(this.cordova.getActivity()).getDefaultTracker();
addCustomDimensionsToTracker(tracker);
if (null != category && category.length() > 0) {
tracker.send(MapBuilder
.createEvent(category, action, label, value)
.build()
);
callbackContext.success("Track Event: " + category);
} else {
callbackContext.error("Expected non-empty string arguments.");
}
}
示例4: onStart
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
final Tracker tracker = EasyTracker.getInstance(getActivity());
tracker.set(Fields.SCREEN_NAME, "Recipes list");
tracker.send(MapBuilder.createAppView().build());
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(RecipesManager.ACTION_FINISH_LOADING_RECIPES);
intentFilter.addAction(RecipesManager.ACTION_START_LOADING_RECIPES);
if (RecipesApplication.isLoadingRecipes) {
getActivity().setProgressBarIndeterminateVisibility(true);
} else {
getActivity().setProgressBarIndeterminateVisibility(false);
}
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(broadcastReceiver,
intentFilter);
}
示例5: onCreate
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_menu);
Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
findViewById(R.id.pack1_button).setOnClickListener(this);
findViewById(R.id.pack2_button).setOnClickListener(this);
Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
tracker.send(MapBuilder.createAppView().set(Fields.SCREEN_NAME, "Home Screen").build());
BugSenseHandler.initAndStartSession(MainMenu.this, "718d6664");
}
示例6: onActivityResult
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1001) {
if (resultCode == Activity.RESULT_OK) {
try {
Intent intent = new Intent(this, DrawerSliderActivity.class);
intent.putExtra("pack", "pack2");
startActivity(intent);
Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
tracker.send(MapBuilder
.createEvent("Buy", "pack", "item_bouth", null)
.build());
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
示例7: done
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
@SuppressWarnings("unused")
public void done(int numberOfParsedObjects) {
if(finished) {
if(BuildConfig.DEBUG) {
//only crash if we are in a dev build
throw new IllegalStateException("Timer already had finished before!");
}
return;
}
finished = true;
Tracker tracker = EasyTracker.getTracker();
long finalTime = SystemClock.elapsedRealtime();
tracker.sendTiming(CATEGORY_SHARED_PREFS, firstStepTime-startTime , name, Integer.toString(numberOfParsedObjects));
tracker.sendTiming(ParsingAnalytics.CATEGORY, finalTime - firstStepTime, name, Integer.toString(numberOfParsedObjects));
tracker.sendTiming(CATEGORY_BOTH, finalTime-startTime , name, Integer.toString(numberOfParsedObjects));
}
示例8: done
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
@SuppressWarnings("unused")
public void done(int numberOfParsedObjects) {
if(finished) {
if(BuildConfig.DEBUG) {
//only crash if we are in a dev build
throw new IllegalStateException("Timer already had finished before!");
}
return;
}
finished = true;
Tracker tracker = EasyTracker.getTracker();
long finalTime = SystemClock.elapsedRealtime();
tracker.sendTiming(CATEGORY_SERIALIZING, firstStepTime-startTime , name, Integer.toString(numberOfParsedObjects));
tracker.sendTiming(CATEGORY_SHARED_PREFS, finalTime - firstStepTime, name, Integer.toString(numberOfParsedObjects));
tracker.sendTiming(CATEGORY_BOTH, finalTime-startTime , name, Integer.toString(numberOfParsedObjects));
}
示例9: sendEvent
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
public static void sendEvent(String eventName){
android.util.Log.d(YandexMetrikaApplication.class.getSimpleName(), "sendEvent "+eventName);
Tracker tracker = getTracker();
if(tracker!=null) {
tracker.send(MapBuilder.createEvent("mm_android", eventName, null, null).build());
}
}
示例10: addCustomDimensionsToTracker
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
private void addCustomDimensionsToTracker(Tracker tracker) {
for (Entry<String, String> entry : customDimensions.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
//System.out.println("Setting tracker dimension slot " + key + ": <" + value+">");
tracker.set(Fields.customDimension(Integer.parseInt(key)), value);
}
}
示例11: onStart
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
final Tracker tracker = EasyTracker.getInstance(getActivity());
tracker.set(Fields.SCREEN_NAME, "Recipe Details");
tracker.send(MapBuilder.createAppView().build());
}
示例12: finish_anim
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
public void finish_anim() {
Animation animFadein = AnimationUtils.loadAnimation(
getApplicationContext(), R.anim.slide_finish);
level_finished.setVisibility(View.VISIBLE);
animFadein.setAnimationListener(finish_anim);
level_finished.startAnimation(animFadein);
int count = screenH / 100;
for (int i = 0; i < count; i++) {
int id_image = 0;
if (i % 2 == 0)
id_image = R.drawable.star_pink;
else
id_image = R.drawable.star_white;
ParticleSystem ps = new ParticleSystem(this, 100, id_image, 800);
ps.setScaleRange(0.7f, 1.3f);
ps.setSpeedRange(0.2f, 0.5f);
ps.setRotationSpeedRange(90, 180);
ps.setFadeOut(200, new AccelerateInterpolator());
int xStart = (int) (screenW * Math.random());
int yStart = (int) (screenH * Math.random());
ps.oneShot(xStart, yStart, 70);
}
final Animation scale = AnimationUtils.loadAnimation(
getApplicationContext(), R.anim.scale_anim);
homeBtn.startAnimation(scale);
Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
tracker.send(MapBuilder
.createEvent("Level", packName, "finish_drawing_" + level, null)
.build());
}
示例13: onClick
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.pack1_button:
Intent intent = new Intent(this, DrawerSliderActivity.class);
intent.putExtra("pack", "pack1");
startActivity(intent);
break;
case R.id.pack2_button:
Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-51610813-3");
tracker.send(MapBuilder
.createEvent("Buy", "pack", "try_to_buy", null)
.build());
if (deviceHasGoogleAccount())
buyClick(v);
else {
tracker.send(MapBuilder
.createEvent("Buy", "pack", "no_account", null)
.build());
}
break;
}
}
示例14: pushSettingChengedEvent
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
/**
* 設定変更をpushする.
*
* @param context {@link Context}
* @param key キー
* @param newValue 値
*/
public static void pushSettingChengedEvent(Context context, String key, Object newValue) {
Tracker tracker = EasyTracker.getInstance(context);
if (newValue != null && newValue instanceof Set) {
pushSettingChengedEvent(tracker, key, (Set<?>) newValue);
} else {
String newValueStr = newValue == null ? "nullpo" : String.valueOf(newValue);
tracker.send(MapBuilder.createEvent("settingChenged", key, newValueStr, null).build());
}
}
示例15: trackAnalytics
import com.google.analytics.tracking.android.Tracker; //导入依赖的package包/类
private void trackAnalytics() {
EasyTracker.getInstance().setContext(this);
Tracker tracker = EasyTracker.getInstance().getTracker();
if (mPhotoUser != null) {
tracker.set("&uid", mPhotoUser.id.toString());
} else {
tracker.set("&uid", null);
}
if (mPhoto != null) {
tracker.trackView("image/" + mPhoto.id);
}
}