The Webtrends SDK is a library for iOS that enables easy integration with Webtrends Optimize. This guide will walk you through the initial setup process, from integrating the SDK with your project, to sending events to Webtrends.

Basic Installation

In its simplest incarnation, the Webtrends SDK can be installed with a few lines in your existing Podfile:

source ''

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 Optimize Advanced Configuration Guide.

Common Actions

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.

Triggering Events

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


// 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];

There are a wide variety of events you can trigger, all of which are documented in WTDataCollector and the Manual Events Guide.

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];

For a full list of configurable settings, see the Optimize Advanced Configuration Guide.

Pausing/Resuming Event Sending

Here’s an example of how to pause then resume event sending:

  • SwiftWTDataCollector.sharedCollector().pause()
  • Objective-C[[WTDataCollector sharedCollector] pause];
    [[WTDataCollector sharedCollector] resume];