diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..bb576db --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +2.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 728e71d..834aa4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.7 +* Supports analytics-ios 3.+ and Appboy 2.30.0+ +* Fixes an issue where install attribution data was being sent up as an event. + ## 1.0.6 * Updates the wrapper SDK to work with Xcode 9 beta 2. diff --git a/Example/Segment-Appboy/SEGViewController.m b/Example/Segment-Appboy/SEGViewController.m index c1536f1..00d0b68 100644 --- a/Example/Segment-Appboy/SEGViewController.m +++ b/Example/Segment-Appboy/SEGViewController.m @@ -69,6 +69,13 @@ - (IBAction)trackButtonPress:(id)sender { properties:@{ propertyKey: propertyValue}]; [[SEGAnalytics sharedAnalytics] track:@"Candy" properties:@{ @"currency": @"CNY", @"revenue" : @"60", @"property" : @"milky white rabbit"}]; + [[SEGAnalytics sharedAnalytics] track:@"Install Attributed" + properties: @{@"provider" : @"Tune/Kochava/Branch", + @"campaign" : @{@"source" : @"Network/FB/AdWords/MoPub/Source", + @"name" : @"Campaign Name", + @"content" : @"Organic Content Title", + @"ad_creative" : @"Red Hello World Ad", + @"ad_group" : @"Red Ones"}}]; } - (IBAction)feedbackButtonPress:(id)sender { diff --git a/Pod/Classes/SEGAppboyIntegration.m b/Pod/Classes/SEGAppboyIntegration.m index 1634cc1..f87fe1d 100644 --- a/Pod/Classes/SEGAppboyIntegration.m +++ b/Pod/Classes/SEGAppboyIntegration.m @@ -2,9 +2,11 @@ #if defined(__has_include) && __has_include() #import #import +#import #else #import "Appboy-iOS-SDK/AppboyKit.h" #import "Appboy-iOS-SDK/ABKUser.h" +#import "Appboy-iOS-SDK/ABKAttributionData.h" #endif #import #import "SEGAppboyIntegrationFactory.h" @@ -165,6 +167,19 @@ - (void)identify:(SEGIdentifyPayload *)payload - (void)track:(SEGTrackPayload *)payload { + if ([payload.event isEqualToString:@"Install Attributed"]) { + if ([payload.properties[@"campaign"] isKindOfClass:[NSDictionary class]]) { + NSDictionary *attributionDataDictionary = (NSDictionary *)payload.properties[@"campaign"]; + ABKAttributionData *attributionData = [[ABKAttributionData alloc] + initWithNetwork:attributionDataDictionary[@"source"] + campaign:attributionDataDictionary[@"name"] + adGroup:attributionDataDictionary[@"ad_group"] + creative:attributionDataDictionary[@"ad_creative"]]; + [[Appboy sharedInstance].user setAttributionData:attributionData]; + return; + } + } + NSDecimalNumber *revenue = [SEGAppboyIntegration extractRevenue:payload.properties withKey:@"revenue"]; if (revenue) { NSString *currency = @"USD"; // Make USD as the default currency. diff --git a/Segment-Appboy.podspec b/Segment-Appboy.podspec index 6ba6e50..38207d8 100644 --- a/Segment-Appboy.podspec +++ b/Segment-Appboy.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Segment-Appboy" - s.version = "1.0.6" + s.version = "1.0.7" s.summary = "Appboy Integration for Segment's analytics-ios library." s.description = <<-DESC