The Webtrends SDK is a library for iOS that enables easy integration with Webtrends Analytics and Webtrends Optimize products. This guide will walk you through the initial setup process, from integrating the SDK with your project, to sending events to Webtrends.
In its simplest incarnation, the Webtrends SDK can be installed with a few lines in your existing
source 'https://github.com/CocoaPods/Specs.git' pod 'Webtrends-SDK/Core', '~>3.0'
If you’re not familiar with CocoaPods, or you need a more advanced installation (such as integrating the Webtrends WatchKit SDK), you can read our Getting Started Guide.
Set up webtrends.plist
After your pod has been installed, you’ll need to set up a basic webtrends.plist file, described below.
You can download an example copy of
webtrends.plist here. Add the file to your project, open it, and replace
YOUR_DCSID_HERE with your unique DCSID. There’s a ton of configuration options available in
webtrends.plist, but the only required setting is the DCSID. You can read more in the Analytics Advanced Configuration Guide or the Optimize Advanced Configuration Guide.
The documentation below has detailed explanations of the entire SDK, but for convenience, this guide provides sample code for a couple common actions you might take with the SDK, such as triggering events, setting configuration settings, and pausing/resuming event sending.
If automatic events are enabled, many events are triggered automatically on your behalf. In most cases you won’t need to do any additional work to receive events related to the application or view controller life cycles. You can read more about this in the Automatic Events Guide.
If you want to manually log events, the process is pretty simple. Here’s an example of how to send an event associated with a button press:
// eventPath can be nil if you want to use the default eventPath let meta = WTEventMeta(eventPath: nil, description: "Sign-in button tapped!", type: "Tap Event", customParams: nil) // Once we've set up our basic information, pass it to the data collector WTDataCollector.sharedCollector().triggerEventForAction(meta)
// eventPath can be nil if you want to use the default eventPath WTEventMeta *meta = [WTEventMeta eventMetaForPath:nil description:@"Sign-in button tapped!" type:@"Tap Event" customParams:nil]; // Once we've set up our basic information, pass it to the data collector [[WTDataCollector sharedCollector] triggerEventForAction:meta];
Setting Configuration Settings
Webtrends provides a wide variety of configurable options that you can use to customize how the SDK behaves. Here’s an example of how to disable Webtrends debug logging programatically:
WTDataCollector.sharedCollector().setValue("false", forConfigKey:kWTConfigDebug, persists: true)
[[WTDataCollector sharedCollector] setValue:@"false" forConfigKey:kWTConfigDebug persists:YES];
Pausing/Resuming Event Sending
Here’s an example of how to pause then resume event sending:
[[WTDataCollector sharedCollector] pause]; [[WTDataCollector sharedCollector] resume];
Hybrid Application Support
Webtrends provides a method of keeping continuing sessions between a web browser and a native app. The process is a little more involved than some of the examples above, but you can read about it in both the Hybrid Events Guide and the [Embedded Browser Events Guide][EmbeddedBrowse].
The complete documentation for the Webtrends iOS SDK can be found at http://help.webtrends.com/en/ios/.
- Analytics - Advanced Configuration Guide
- Analytics - Automatic Events Guide
- Analytics - Embedded Browser Events Guide
- Analytics - Event Parameter Reference
- Analytics - Event Sending Failures
- Analytics - Hybrid Events Guide
- Analytics - Manual Events Guide
- Analytics - Webtrends WatchKit SDK Guide
- Core SDK - Getting Started Guide
- Core SDK - License Agreement
- Core SDK - Remote Configuration Service (RCS)
- Core SDK - Setting Configuration Values
- Optimize - Advanced Configuration Guide
- Optimize - Factor JSON Formatting Guide
- Optimize - Getting Started Guide
- Optimize - Hybrid Events Guide
- Optimize - Tracking Conversions
- Optimize - Using Optimize in your Code
- Sample Applications Guide
- Troubleshooting Guide