从早期版本升级?请参阅 升级通知
所包含的框架允许对移动应用程序进行一次原生前标记,然后通过 Tealium IQ 在远程处配置第三方分析服务;所有这些都不需要为这些服务的每个更新重新编写和重新部署应用程序。
第一次实施应阅读 Tealium 工作原理wiki 页面以了解 Tealium SDK 与传统分析 SDK 的不同之处。有关任何其他信息,请参阅 wiki 主页。
本文档的其余部分提供了实施资源密集度较低的紧凑库的快速安装说明。
本指南假定您已经使用 XCode 创建了一个 iOS 应用程序。按照以下步骤将 Tealium 的紧凑库添加到其中。有关哪个版本最适合您的讨论,请参阅 接下来是什么 部分。
通过在主仓库页面上点击“克隆到桌面”或“下载 ZIP”按钮,将其克隆/复制到您的开发机器上。
2a. 从ios-library/TealiumCompact文件夹中,将TealiumLibrary.framework(/tealiumcompact/tealiumlibrary.framework)拖放到XCode项目导航窗口中。
2b. 在出现的对话框中点击“完成”。
将以下Apple框架链接到您的项目中链接以下框架
您的项目-target-通用选项卡现在应该看起来类似
将"-ObjC"链接器标志添加到项目的Target-构建设置中
5o1. 将库导入到项目中的.pch文件中的以下代码块
#ifdef __OBJC__
//...
#import <TealiumLibrary/Tealium.h>
#endif
5o2. 在appDelegate.m类中初始化库
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
//...
[Tealium initSharedInstance:@"tealiummobile" profile:@"demo" target:@"dev"];
// (!) Don't forget to replace "tealiummobile", "demo" and "dev" with your own account-profile-target settings before creating your production build.
}
5s1. 导入Tealium-bridging-header.h
5s2. 更新项目的构建设置:Swift编译器 - 代码生成
5s3. 添加初始化语句
Tealium.initSharedInstance("tealiummobile", profile: "demo", target: "dev", options:TealiumOptions.TLNone, globalCustomData: nil)
现在,您的应用已准备好编译和运行。在控制台输出中您应看到类似
2015-04-07 15:44:00.495 UICatalog_TealiumCompactLibrary[3771:1786056] TEALIUM 4.1.3c: Init settings: {
AccountInfo = {
Account = tealiummobile;
Profile = demo;
Target = dev;
};
Settings = {
AdditionalCustomData = {
};
ExcludeClasses = (
);
LogVerbosity = 1;
UseExceptionTracking = 1;
UseHTTPS = 1;
};
}
2015-04-07 15:44:00.496 UICatalog_TealiumCompactLibrary[3771:1786056] TEALIUM 4.1.3c: Initializing...
2015-04-07 15:44:00.687 UICatalog_TealiumCompactLibrary[3771:1786056] TEALIUM 4.1.3c: Adding new command: _push
2015-04-07 15:44:00.688 UICatalog_TealiumCompactLibrary[3771:1786056] TEALIUM 4.1.3c: Adding new command: _http
2015-04-07 15:44:00.691 UICatalog_TealiumCompactLibrary[3771:1786062] TEALIUM 4.1.3c: Network is available.
2015-04-07 15:44:00.735 UICatalog_TealiumCompactLibrary[3771:1786062] TEALIUM 4.1.3c: App Launch detected.
2015-04-07 15:44:00.762 UICatalog_TealiumCompactLibrary[3771:1786062] TEALIUM 4.1.3c: Queued auto link dispatch for TealiumLifecycle : launch : 2015-04-07T15:44:00. 1 dispatch queued.
2015-04-07 15:44:01.135 UICatalog_TealiumCompactLibrary[3771:1786035] TEALIUM 4.1.3c: Connection established with mobile.html at https://tags.tiqcdn.com/utag/tealiummobile/demo/dev/mobile.html?platform=iOS&os_version=8.2&library_version=4.1.3×tamp_unix=1428446640.
2015-04-07 15:44:01.328 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: UTAG found in mobile.html: true
2015-04-07 15:44:01.328 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Initialized.
2015-04-07 15:44:01.669 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: UIAutotracking: ON (ignoring)
2015-04-07 15:44:01.670 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: IVar Tracking: ON (ignoring)
2015-04-07 15:44:01.670 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Batch limit: 1
2015-04-07 15:44:01.671 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Wifi sending only: OFF
2015-04-07 15:44:01.671 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Battery save feature: ON
2015-04-07 15:44:01.672 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Offline dispatch cache: -1
2015-04-07 15:44:01.672 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Queued dispatch expiration: -1
2015-04-07 15:44:01.673 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Mobile Companion: ON (ignoring)
2015-04-07 15:44:01.674 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Sending 1 queued dispatch.
2015-04-07 15:44:01.737 UICatalog_TealiumCompactLibrary[3771:1786054] TEALIUM 4.1.3c: Successfully packaged auto link dispatch for TealiumLifecycle : launch : 2015-04-07T15:44:00
恭喜!您已成功将Tealium Compact库集成到项目中。
如果您已禁用网络连接以测试离线缓存,则会看到类似
2015-04-07 15:45:57.407 UICatalog_TealiumCompactLibrary[3779:1786965] TEALIUM 4.1.3c: Init settings: {
AccountInfo = {
Account = tealiummobile;
Profile = demo;
Target = dev;
};
Settings = {
AdditionalCustomData = {
};
ExcludeClasses = (
);
LogVerbosity = 1;
UseExceptionTracking = 1;
UseHTTPS = 1;
};
}
2015-04-07 15:45:57.408 UICatalog_TealiumCompactLibrary[3779:1786965] TEALIUM 4.1.3c: Initializing...
2015-04-07 15:45:57.627 UICatalog_TealiumCompactLibrary[3779:1786965] TEALIUM 4.1.3c: Adding new command: _push
2015-04-07 15:45:57.628 UICatalog_TealiumCompactLibrary[3779:1786965] TEALIUM 4.1.3c: Adding new command: _http
2015-04-07 15:45:57.632 UICatalog_TealiumCompactLibrary[3779:1786965] TEALIUM 4.1.3c: Network is not available.
2015-04-07 15:45:57.719 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: NO INTERNET connection detected.
2015-04-07 15:45:57.719 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Trying to reconnect (attempt 1 of 3)...
2015-04-07 15:45:58.841 UICatalog_TealiumCompactLibrary[3779:1786963] TEALIUM 4.1.3c: NO INTERNET connection detected.
2015-04-07 15:45:58.842 UICatalog_TealiumCompactLibrary[3779:1786963] TEALIUM 4.1.3c: Trying to reconnect (attempt 2 of 3)...
2015-04-07 15:45:59.963 UICatalog_TealiumCompactLibrary[3779:1786968] TEALIUM 4.1.3c: NO INTERNET connection detected.
2015-04-07 15:45:59.964 UICatalog_TealiumCompactLibrary[3779:1786968] TEALIUM 4.1.3c: Trying to reconnect (attempt 3 of 3)...
2015-04-07 15:46:01.082 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: NO INTERNET connection detected.
2015-04-07 15:46:01.084 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Saved configuration loaded: true
2015-04-07 15:46:01.085 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: No new configuration data found from mobile.html. Library will continue running with last saved configuration.
2015-04-07 15:46:01.086 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: UIAutotracking: ON (ignoring)
2015-04-07 15:46:01.086 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: IVar Tracking: ON (ignoring)
2015-04-07 15:46:01.087 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Batch limit: 1
2015-04-07 15:46:01.088 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Wifi sending only: OFF
2015-04-07 15:46:01.089 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Battery save feature: ON
2015-04-07 15:46:01.089 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Offline dispatch cache: -1
2015-04-07 15:46:01.090 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Queued dispatch expiration: -1
2015-04-07 15:46:01.090 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Mobile Companion: ON (ignoring)
2015-04-07 15:46:01.090 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Initialized.
2015-04-07 15:46:01.091 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: App Launch detected.
2015-04-07 15:46:01.154 UICatalog_TealiumCompactLibrary[3779:1786967] TEALIUM 4.1.3c: Queued auto link dispatch for TealiumLifecycle : launch : 2015-04-07T15:46:01. 1 dispatch queued.
以下两种推荐的分发验证方法:
AudienceStream live events提供实时可视化的分发数据,如果Tealium DataCloud标签已经添加了与用于初始化库相同的TIQ账户配置文件。
具有实时处理的分析供应商(例如Google Analytics),也可以用于验证分发,如果数据源已被正确映射到目标供应商的变量。
注意:没有实时处理的供应商可能需要几个小时才能更新其报告。
现在您已成功集成库,您应确定哪个版本(紧凑型或完整库)最适合您的需求。以下是主要区别:
紧凑型 | 完整型 | |
---|---|---|
库编译大小 | ~600 KB | ~900 KB |
初始化时间 | +<1 毫秒 | +<1 毫秒 |
运行时内存使用情况 | +3.3 MB | +5.0 MB |
自定义数据跟踪 | 是 | 是 |
设备数据跟踪 | 是 | 是 |
生命周期跟踪 | 是 | 是 |
离线跟踪 | 是 | 是 |
标签桥接器 | 是 | 是 |
时间戳跟踪 | 是 | 是 |
AudienceStream追踪 | 没有 | 是 |
移动伴侣 | 没有 | 是 |
UI自动跟踪 | 没有 | 是 |
视频跟踪 | 没有 | 是 |
(A) 继续使用紧凑型版本,添加任何需要的附加跟踪调用,用于事件或视图出现。
(B) 转换到完整版本,查看我们的基本实现指南,注意额外的设置要求。
还是不能做出决定吗?浏览我们的wiki页面获取更多信息,或者阅读
有任何问题或意见吗?
<TealiumLibrary/Tealium.h>
。版权(C) 2012-2015,Tealium Inc。