本文整理汇总了Java中com.segment.analytics.Analytics类的典型用法代码示例。如果您正苦于以下问题:Java Analytics类的具体用法?Java Analytics怎么用?Java Analytics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Analytics类属于com.segment.analytics包,在下文中一共展示了Analytics类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ReportPagesRead
import com.segment.analytics.Analytics; //导入依赖的package包/类
private void ReportPagesRead()
{
try {
// let's differentiate between pages read and audio book pages read: (BL-5082)
Properties p = new Properties();
p.putValue("title", mBookName);
p.putValue("audioPages", mAudioPagesPlayed);
p.putValue("nonAudioPages", mNonAudioPagesShown);
p.putValue("totalNumberedPages", mNumberedPageCount);
p.putValue("lastNumberedPageRead", mLastNumberedPageRead);
p.putValue("questionCount", mAdapter.mQuestions.size());
p.putValue("contentLang", mContentLang1);
if (mBrandingProjectName != null) {
p.putValue("brandingProjectName", mBrandingProjectName);
}
Analytics.with(BloomReaderApplication.getBloomApplicationContext()).track("Pages Read", p);
} catch (Exception e) {
Log.e(TAG, "Pages Read", e);
BloomReaderApplication.VerboseToast("Error reporting Pages Read");
}
}
开发者ID:BloomBooks,项目名称:BloomReader,代码行数:22,代码来源:ReaderActivity.java
示例2: reportLoadBook
import com.segment.analytics.Analytics; //导入依赖的package包/类
private void reportLoadBook(String path)
{
try {
String filenameWithExtension = new File(path).getName();
// this mBookName is used by subsequent analytics reports
mBookName = filenameWithExtension.substring(0, filenameWithExtension.length() - BookOrShelf.BOOK_FILE_EXTENSION.length());
Properties p = new Properties();
p.putValue("title", mBookName);
p.putValue("totalNumberedPages", mNumberedPageCount);
p.putValue("contentLang", mContentLang1);
p.putValue("questionCount", mAdapter.mQuestions.size());
if (mBrandingProjectName != null) {
p.putValue("brandingProjectName", mBrandingProjectName);
}
Analytics.with(BloomReaderApplication.getBloomApplicationContext()).track("BookOrShelf opened", p);
} catch (Exception error) {
Log.e("Reader", "Error reporting load of " + path + ". "+ error);
BloomReaderApplication.VerboseToast("Error reporting load of "+path);
}
}
开发者ID:BloomBooks,项目名称:BloomReader,代码行数:21,代码来源:ReaderActivity.java
示例3: identifyDevice
import com.segment.analytics.Analytics; //导入依赖的package包/类
private static void identifyDevice(){
SharedPreferences values = getBloomApplicationContext().getSharedPreferences(SHARED_PREFERENCES_TAG, 0);
if(values.getString(ANALYTICS_DEVICE_ID, null) == null){
boolean deviceIdFromFile = parseDeviceIdFile(values.edit());
if(!deviceIdFromFile)
return;
}
String project = values.getString(ANALYTICS_DEVICE_PROJECT, "");
String device = values.getString(ANALYTICS_DEVICE_ID, "");
// The value used with identify() needs to be globally unique. Just in case somebody
// might reuse a deviceId in a different project, we concatenate them.
String deviceId = project + "-" + device;
Analytics.with(getBloomApplicationContext()).identify(deviceId);
Analytics.with(getBloomApplicationContext()).group(project);
}
开发者ID:BloomBooks,项目名称:BloomReader,代码行数:17,代码来源:BloomReaderApplication.java
示例4: create
import com.segment.analytics.Analytics; //导入依赖的package包/类
@Override
public Integration<?> create(ValueMap settings, Analytics analytics) {
Logger logger = analytics.logger(LEANPLUM_SEGMENT_KEY);
String appId = settings.getString("appId");
String key = settings.getString("clientKey");
Boolean isDevelopmentMode = settings.getBoolean("devMode", false);
if (TextUtils.isEmpty(appId)) {
throw new LeanplumException("Please add Leanplum app id in Segment " +
"settings.");
}
if (TextUtils.isEmpty(key)) {
throw new LeanplumException("Please add Leanplum client key in " +
"Segment settings.");
}
return new LeanplumIntegration(analytics.getApplication(), appId, key,
logger, isDevelopmentMode);
}
开发者ID:Leanplum,项目名称:Leanplum-Segment-Android,代码行数:20,代码来源:LeanplumIntegration.java
示例5: getInstance
import com.segment.analytics.Analytics; //导入依赖的package包/类
/**
* Initializes instance of AnalyticsTracker class
**/
public static AnalyticsTracker getInstance(@NonNull Context context, boolean isWearable) {
if (analyticsInstance == null) { // Single check
synchronized (AnalyticsTracker.class) {
if (analyticsInstance == null) { // Double check
analyticsInstance = new AnalyticsTracker();
analyticsInstance.appContext = context;
analyticsInstance.deviceIsWearable = isWearable;
if (isWearable) {
analytics = Analytics.builder(context.getString(R.string.mapbox_segment_wearable_write_key)).build();
} else {
analytics = Analytics.builder(context.getString(R.string.mapbox_segment_write_key)).build();
}
}
}
}
return analyticsInstance;
}
开发者ID:mapbox,项目名称:mapbox-android-demo,代码行数:21,代码来源:AnalyticsTracker.java
示例6: initAnalytics
import com.segment.analytics.Analytics; //导入依赖的package包/类
@PostConstruct
private void initAnalytics() {
final String token = EnvironmentSupport.INSTANCE.getEnvVarOrSysProp(
LAUNCHER_TRACKER_SEGMENT_TOKEN);
if (token != null && !token.isEmpty()) {
analytics = Analytics.builder(token).networkExecutor(async).build();
log.finest(() -> "Using Segment analytics with token: " + token);
}
}
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:10,代码来源:SegmentAnalyticsProvider.java
示例7: initialize
import com.segment.analytics.Analytics; //导入依赖的package包/类
public static void initialize(Context context) {
SEGAnalytics.context = context.getApplicationContext();
//FIXME need to find method call whether analytics are set or export this part to application class
try {
Analytics.with(context);
} catch (IllegalArgumentException exception) {
// Create an analytics client with the given context and Segment write key.
if (!analyticsKey.isEmpty()) {
Analytics analytics = new Analytics.Builder(context, analyticsKey).build();
analytics.optOut(analyticsOptOut);
Analytics.setSingletonInstance(analytics);
}
}
}
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:15,代码来源:SEGAnalytics.java
示例8: onCreate
import com.segment.analytics.Analytics; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
sApplicationContext = getApplicationContext();
String writeKey = "FSepBapJtfOi3FfhsEWQjc2Dw0O3ixuY"; // Source BloomReaderTest
if (InTestModeForAnalytics()) {
VerboseToast("Using Test Analytics");
} else {
if (BuildConfig.FLAVOR == "production") {
writeKey = "EfisyNbRjBYIHyHZ9njJcs5dWF4zabyH"; // Source BloomReader
} else {
writeKey = "HRltJ1F4vEVgCypIMeRVnjLAMUTAyOAI"; // Source BloomReaderBeta
}
}
// Create an analytics client with the given context and Segment write key.
Analytics analytics = new Analytics.Builder(sApplicationContext, writeKey)
// Tracks Application Opened, Application Installed, Application Updated
.trackApplicationLifecycleEvents()
// Tracks each screen opened
.recordScreenViews()
.build();
try {
String version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
String[] numbers = version.split("\\.");
analytics.getAnalyticsContext().putValue("majorMinor", numbers[0] + "." + numbers[1]);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
// Set the initialized instance as a globally accessible instance.
Analytics.setSingletonInstance(analytics);
// Check for deviceId json file and use its contents to identify this device
identifyDevice();
}
开发者ID:BloomBooks,项目名称:BloomReader,代码行数:40,代码来源:BloomReaderApplication.java
示例9: setup
import com.segment.analytics.Analytics; //导入依赖的package包/类
@ReactMethod
public void setup(String configKey) {
try {
Analytics analytics = new Analytics.Builder(this.getReactApplicationContext(), configKey)
.trackApplicationLifecycleEvents() // Enable this to record certain application events automatically!
.recordScreenViews() // Enable this to record screen views automatically!
.build();
Analytics.setSingletonInstance(analytics);
} catch (Exception e) {
Log.e("SegmentAnalyticsModule", "Failed to setup. " + e.getMessage());
}
}
开发者ID:charlires,项目名称:react-native-segment-analytics,代码行数:13,代码来源:SegmentAnalyticsModule.java
示例10: identify
import com.segment.analytics.Analytics; //导入依赖的package包/类
@ReactMethod
public void identify(String userId, ReadableMap traits) {
try {
Analytics.with(this.getReactApplicationContext()).identify(
userId,
toTraits(traits),
null
);
} catch (Exception e) {
Log.e("SegmentAnalyticsModule", "Failed to identify " + userId + ". " + e.getMessage());
}
}
开发者ID:charlires,项目名称:react-native-segment-analytics,代码行数:13,代码来源:SegmentAnalyticsModule.java
示例11: track
import com.segment.analytics.Analytics; //导入依赖的package包/类
@ReactMethod
public void track(String trackText, ReadableMap properties) {
try {
Analytics.with(this.getReactApplicationContext()).track(
trackText,
this.toProperties(properties)
);
} catch (Exception e) {
Log.e("SegmentAnalyticsModule", "Failed to track " + trackText + ". " + e.getMessage());
}
}
开发者ID:charlires,项目名称:react-native-segment-analytics,代码行数:12,代码来源:SegmentAnalyticsModule.java
示例12: screen
import com.segment.analytics.Analytics; //导入依赖的package包/类
@ReactMethod
public void screen(String screenName, ReadableMap properties) {
try {
Analytics.with(this.getReactApplicationContext()).screen(
null,
screenName,
this.toProperties(properties));
} catch (Exception e) {
Log.e("SegmentAnalyticsModule", "Failed to screen " + screenName + ". " + e.getMessage());
}
}
开发者ID:charlires,项目名称:react-native-segment-analytics,代码行数:12,代码来源:SegmentAnalyticsModule.java
示例13: alias
import com.segment.analytics.Analytics; //导入依赖的package包/类
@ReactMethod
public void alias(String newId) {
try {
Analytics.with(this.getReactApplicationContext()).alias(
newId,
null
);
} catch (Exception e) {
Log.e("SegmentAnalyticsModule", "Failed to alias " + newId + ". " + e.getMessage());
}
}
开发者ID:charlires,项目名称:react-native-segment-analytics,代码行数:12,代码来源:SegmentAnalyticsModule.java
示例14: onCreate
import com.segment.analytics.Analytics; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LeanplumPushService.setGcmSenderId(LeanplumPushService.LEANPLUM_SENDER_ID);
// Create an analytics client with the given context and Segment write key.
Analytics analytics = new Analytics
.Builder(getApplicationContext(), SEGMENT_WRITE_KEY)
.use(LeanplumIntegration.FACTORY)
.build();
analytics.onIntegrationReady(LeanplumIntegration.LEANPLUM_SEGMENT_KEY,
new Analytics.Callback() {
@Override
public void onReady(Object instance) {
Leanplum.track("test");
}
});
// Set the initialized instance as a globally accessible instance.
Analytics.setSingletonInstance(analytics);
Traits traits = new Traits()
.putName("First Last")
.putEmail("[email protected]");
Analytics.with(getApplicationContext())
.identify("f4ca124298", traits, null);
Properties properties = new Properties()
.putValue("plan", "Enterprise");
Analytics.with(getApplicationContext()).track("Signed up", properties);
Analytics.with(getApplicationContext()).screen("Main", "Start");
}
开发者ID:Leanplum,项目名称:Leanplum-Segment-Android,代码行数:36,代码来源:MainActivity.java
示例15: trackButtonClicked
import com.segment.analytics.Analytics; //导入依赖的package包/类
public void trackButtonClicked(View view) {
Properties properties = new Properties()
.putPrice(0.99)
.putCurrency("USD")
.putTitle("InApp Purchase");
Analytics.with(getApplicationContext())
.track("Track Button Clicked!", properties);
}
开发者ID:Leanplum,项目名称:Leanplum-Segment-Android,代码行数:9,代码来源:MainActivity.java
示例16: setUp
import com.segment.analytics.Analytics; //导入依赖的package包/类
@Before
public void setUp() {
initMocks(this); // initializes the mockes objecs by annoation
mockStatic(Leanplum.class);
logger = Logger.with(Analytics.LogLevel.DEBUG);
when(analytics.logger("Leanplum")).thenReturn(logger);
when(analytics.getApplication()).thenReturn(context);
integration =
new LeanplumIntegration(context, "appId", "key", logger, true);
}
开发者ID:Leanplum,项目名称:Leanplum-Segment-Android,代码行数:12,代码来源:LeanplumIntegrationTest.java
示例17: initAnalytics
import com.segment.analytics.Analytics; //导入依赖的package包/类
@PostConstruct
private void initAnalytics() {
final String token = EnvironmentSupport.INSTANCE.getEnvVarOrSysProp(
LAUNCHPAD_TRACKER_SEGMENT_TOKEN);
if (token != null && !token.isEmpty()) {
analytics = Analytics.builder(token).networkExecutor(async).build();
log.finest(() -> "Using Segment analytics with token: " + token);
}
}
开发者ID:fabric8-launcher,项目名称:launchpad-missioncontrol,代码行数:10,代码来源:SegmentAnalyticsProvider.java
示例18: initialize
import com.segment.analytics.Analytics; //导入依赖的package包/类
public static void initialize(Context context) {
SEGAnalytics.context = context.getApplicationContext();
try {
Analytics.with(context);
} catch (IllegalArgumentException exception) {
if (!analyticsKey.isEmpty()) {
Analytics analytics = new Analytics.Builder(context, analyticsKey).build();
analytics.optOut(analyticsOptOut);
Analytics.setSingletonInstance(analytics);
}
}
}
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:13,代码来源:SEGAnalytics.java
示例19: onCreate
import com.segment.analytics.Analytics; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
CalligraphyConfig.initDefault(
new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/CircularStd-Book.otf")
.setFontAttrId(R.attr.fontPath)
.build());
// Initialize a new instance of the Analytics client.
Analytics.Builder builder =
new Analytics.Builder(this, ANALYTICS_WRITE_KEY)
.trackApplicationLifecycleEvents()
.trackAttributionInformation()
.recordScreenViews();
// Set the initialized instance as a globally accessible instance.
Analytics.setSingletonInstance(builder.build());
// Now anytime you call Analytics.with, the custom instance will be returned.
Analytics analytics = Analytics.with(this);
// If you need to know when integrations have been initialized, use the onIntegrationReady
// listener.
analytics.onIntegrationReady(
"Segment.io",
new Analytics.Callback() {
@Override
public void onReady(Object instance) {
Log.d("Segment Sample", "Segment integration ready.");
}
});
}
开发者ID:segmentio,项目名称:analytics-android,代码行数:35,代码来源:SampleApp.java
示例20: getAnalytics
import com.segment.analytics.Analytics; //导入依赖的package包/类
@Produces
private Analytics getAnalytics() {
return analytics;
}
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:5,代码来源:SegmentAnalyticsProvider.java
注:本文中的com.segment.analytics.Analytics类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论