diff --git a/Adjust.podspec b/Adjust.podspec index ccb21fef4..8842dcc9c 100644 --- a/Adjust.podspec +++ b/Adjust.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = "Adjust" - s.version = "3.3.3" + s.version = "3.3.4" s.summary = "This is the iOS SDK of Adjust. You can read more about it at http://adjust.io." s.homepage = "http://adjust.io" s.license = { :type => 'MIT', :file => 'MIT-LICENSE' } s.author = { "Christian Wellenbrock" => "welle@adjust.com" } - s.source = { :git => "https://github.com/adeven/adjust_ios_sdk.git", :tag => "v3.3.3" } + s.source = { :git => "https://github.com/adeven/adjust_ios_sdk.git", :tag => "v3.3.4" } s.platform = :ios, '4.3' s.framework = 'SystemConfiguration' s.weak_framework = 'AdSupport', 'iAd' diff --git a/Adjust/AIResponseData.h b/Adjust/AIResponseData.h index e1d789ade..e1cfad6c0 100644 --- a/Adjust/AIResponseData.h +++ b/Adjust/AIResponseData.h @@ -45,6 +45,19 @@ // tracker name of current device @property (nonatomic, copy) NSString *trackerName; +// tracker network +@property (nonatomic, copy) NSString *network; + +// tracker campaign +@property (nonatomic, copy) NSString *campaign; + +// tracker adgroup +@property (nonatomic, copy) NSString *adgroup; + +// tracker creative +@property (nonatomic, copy) NSString *creative; + + // returns human readable version of activityKind // (session, event, revenue), see above - (NSString *)activityKindString; diff --git a/Adjust/AIResponseData.m b/Adjust/AIResponseData.m index c1498211a..c58e51f64 100644 --- a/Adjust/AIResponseData.m +++ b/Adjust/AIResponseData.m @@ -34,6 +34,10 @@ - (id)initWithJsonString:(NSString *)jsonString { self.error = [jsonDict objectForKey:@"error"]; self.trackerToken = [jsonDict objectForKey:@"tracker_token"]; self.trackerName = [jsonDict objectForKey:@"tracker_name"]; + self.network = [jsonDict objectForKey:@"network"]; + self.campaign = [jsonDict objectForKey:@"campaign"]; + self.adgroup = [jsonDict objectForKey:@"adgroup"]; + self.creative = [jsonDict objectForKey:@"creative"]; return self; } @@ -53,13 +57,19 @@ - (NSString *)activityKindString { } - (NSString *)description { - return [NSString stringWithFormat:@"[kind:%@ success:%d willRetry:%d error:%@ trackerToken:%@ trackerName:%@]", + return [NSString stringWithFormat:@"[kind:%@ success:%d willRetry:%d " + "error:%@ trackerToken:%@ trackerName:%@ " + "network:%@ campaign:%@ adgroup:%@ creative:%@]", self.activityKindString, self.success, self.willRetry, self.error.aiQuote, self.trackerToken, - self.trackerName.aiQuote]; + self.trackerName.aiQuote, + self.network.aiQuote, + self.campaign.aiQuote, + self.adgroup.aiQuote, + self.creative.aiQuote]; } - (NSDictionary *)dictionary { @@ -81,6 +91,22 @@ - (NSDictionary *)dictionary { [responseDataDic setObject:self.trackerName forKey:@"trackerName"]; } + if (self.network != nil) { + [responseDataDic setObject:self.network forKey:@"network"]; + } + + if (self.campaign != nil) { + [responseDataDic setObject:self.campaign forKey:@"campaign"]; + } + + if (self.adgroup != nil) { + [responseDataDic setObject:self.adgroup forKey:@"adgroup"]; + } + + if (self.creative != nil) { + [responseDataDic setObject:self.creative forKey:@"creative"]; + } + return responseDataDic; } diff --git a/Adjust/AIUtil.m b/Adjust/AIUtil.m index 7989b20c4..3e78241d2 100644 --- a/Adjust/AIUtil.m +++ b/Adjust/AIUtil.m @@ -14,7 +14,7 @@ #include static NSString * const kBaseUrl = @"https://app.adjust.io"; -static NSString * const kClientSdk = @"ios3.3.3"; +static NSString * const kClientSdk = @"ios3.3.4"; static NSString * const kDateFormat = @"yyyy-MM-dd'T'HH:mm:ss'Z'Z"; static NSDateFormatter * dateFormat; diff --git a/AdjustTests/AIActivityHandlerTests.m b/AdjustTests/AIActivityHandlerTests.m index 4174c325c..d7bbbe1a5 100644 --- a/AdjustTests/AIActivityHandlerTests.m +++ b/AdjustTests/AIActivityHandlerTests.m @@ -90,7 +90,7 @@ - (void)testFirstRun AIActivityPackage *activityPackage = (AIActivityPackage *) self.packageHandlerMock.packageQueue[0]; // check the Sdk version is being tested - XCTAssertEqual(@"ios3.3.3", activityPackage.clientSdk, @"%@", activityPackage.extendedString); + XCTAssertEqual(@"ios3.3.4", activityPackage.clientSdk, @"%@", activityPackage.extendedString); // check the server url XCTAssertEqual(@"https://app.adjust.io", AIUtil.baseUrl); diff --git a/AdjustTests/AIRequestHandlerTests.m b/AdjustTests/AIRequestHandlerTests.m index e25633949..ad7103598 100644 --- a/AdjustTests/AIRequestHandlerTests.m +++ b/AdjustTests/AIRequestHandlerTests.m @@ -76,7 +76,8 @@ - (void)testSendPackage // check the response data, the kind is unknown because is set by the package handler NSString *sresponseData= [NSString stringWithFormat:@"%@", self.packageHandlerMock.responseData]; - XCTAssert([sresponseData isEqualToString:@"[kind:unknown success:1 willRetry:0 error:(null) trackerToken:token trackerName:name]"], + XCTAssert([sresponseData isEqualToString:@"[kind:unknown success:1 willRetry:0 error:(null) " + "trackerToken:token trackerName:name network:network campaign:campaign adgroup:adgroup creative:creative]"], @"%@", sresponseData); // check that the package was successfully sent @@ -110,7 +111,8 @@ - (void)testConnectionError { // check the response data, NSString *sresponseData= [NSString stringWithFormat:@"%@", self.packageHandlerMock.responseData]; - XCTAssert([sresponseData isEqualToString:@"[kind:unknown success:0 willRetry:1 error:'connection error' trackerToken:(null) trackerName:(null)]"], @"%@", sresponseData); + XCTAssert([sresponseData isEqualToString:@"[kind:unknown success:0 willRetry:1 error:'connection error' " + "trackerToken:(null) trackerName:(null) network:(null) campaign:(null) adgroup:(null) creative:(null)]"], @"%@", sresponseData); // check that the package was successfully sent XCTAssert([self.loggerMock containsMessage:AILogLevelError beginsWith:@"Failed to track session. (connection error) Will retry later."], @@ -136,14 +138,15 @@ - (void)testResponseError { // check the URL Connection was called XCTAssert([self.loggerMock containsMessage:AILogLevelTest beginsWith:@"NSURLConnection sendSynchronousRequest"], @"%@", self.loggerMock); - // check that the package handler was pinged after sending XCTAssert([self.loggerMock containsMessage:AILogLevelTest beginsWith:@"AIPackageHandler finishedTrackingActivity"], @"%@", self.loggerMock); // check the response data, NSString *sresponseData= [NSString stringWithFormat:@"%@", self.packageHandlerMock.responseData]; - XCTAssert([sresponseData isEqualToString:@"[kind:unknown success:0 willRetry:0 error:'response error' trackerToken:token trackerName:name]"], @"%@", sresponseData); + + XCTAssert([sresponseData isEqualToString:@"[kind:unknown success:0 willRetry:0 error:'response error' " + "trackerToken:(null) trackerName:(null) network:(null) campaign:(null) adgroup:(null) creative:(null)]"], @"%@", sresponseData); // check that the package was successfully sent XCTAssert([self.loggerMock containsMessage:AILogLevelError beginsWith:@"Failed to track session. (response error)"], diff --git a/AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m b/AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m index 625e09bea..98d99838c 100644 --- a/AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m +++ b/AdjustTests/NSURLConnection+NSURLConnectionSynchronousLoadingMocking.m @@ -29,12 +29,12 @@ + (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NS NSString * sResponseBase64; if (triggerResponseError) { statusCode = 0; - // encoded from "{"error":"response error","tracker_token":"token","tracker_name":"name"}" - sResponseBase64 = @"eyJlcnJvciI6InJlc3BvbnNlIGVycm9yIiwidHJhY2tlcl90b2tlbiI6InRva2VuIiwidHJhY2tlcl9uYW1lIjoibmFtZSJ9"; + // encoded from "{"error":"response error"}" + sResponseBase64 = @"eyJlcnJvciI6InJlc3BvbnNlIGVycm9yIn0="; } else { statusCode = 200; - // encoded from "{"tracker_token":"token","tracker_name":"name"}" - sResponseBase64 = @"eyJ0cmFja2VyX3Rva2VuIjoidG9rZW4iLCJ0cmFja2VyX25hbWUiOiJuYW1lIn0="; + // encoded from "{"tracker_token":"token","tracker_name":"name", "network":"network", "campaign":"campaign", "adgroup":"adgroup", "creative":"creative"}" + sResponseBase64 = @"eyJ0cmFja2VyX3Rva2VuIjoidG9rZW4iLCJ0cmFja2VyX25hbWUiOiJuYW1lIiwgIm5ldHdvcmsiOiJuZXR3b3JrIiwgImNhbXBhaWduIjoiY2FtcGFpZ24iLCAiYWRncm91cCI6ImFkZ3JvdXAiLCAiY3JlYXRpdmUiOiJjcmVhdGl2ZSJ9"; } // build response (*response) = [[NSHTTPURLResponse alloc] initWithURL:[[NSURL alloc] init] statusCode:statusCode HTTPVersion:@"" headerFields:nil]; diff --git a/README.md b/README.md index c09b56c1f..2772e9397 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ If you're using [CocoaPods][cocoapods], you can add the following line to your `Podfile` and continue with [step 3](#step3): ```ruby -pod 'Adjust', :git => 'git://github.com/adjust/ios_sdk.git', :tag => 'v3.3.3' +pod 'Adjust', :git => 'git://github.com/adjust/ios_sdk.git', :tag => 'v3.3.4' ``` ### 1. Get the SDK diff --git a/VERSION b/VERSION index 619b53766..a0891f563 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.3.3 +3.3.4 diff --git a/doc/migrate.md b/doc/migrate.md index b409ff954..14f70c831 100644 --- a/doc/migrate.md +++ b/doc/migrate.md @@ -1,4 +1,4 @@ -## Migrate your adjust SDK for iOS to v3.3.3 from v3.0.0 +## Migrate your adjust SDK for iOS to v3.3.4 from v3.0.0 We added an optional parameter `transactionId` to our `trackRevenue` methods. If you are tracking In-App Purchases you might want to pass in the transaction identifier provided by Apple to avoid duplicate revenue tracking. It should look roughly like this: @@ -36,14 +36,14 @@ all adjust SDK calls. ![][rename] -3. Download version v3.3.3 and drag the new folder `Adjust` into your Xcode +3. Download version v3.3.4 and drag the new folder `Adjust` into your Xcode Project Navigator. ![][drag] 4. Build your project to confirm that everything is properly connected again. -The adjust SDK v3.3.3 added delegate callbacks. Check out the [README] for +The adjust SDK v3.3.4 added delegate callbacks. Check out the [README] for details. @@ -99,7 +99,7 @@ meaningful at all times! Especially if you are tracking revenue. 1. The `appDidLaunch` method now expects your App Token instead of your App ID. You can find your App Token in your [dashboard]. -2. The adjust SDK for iOS 3.3.3 uses [ARC][arc]. If you haven't done already, +2. The adjust SDK for iOS 3.3.4 uses [ARC][arc]. If you haven't done already, we recommend [transitioning your project to use ARC][transition] as well. If you don't want to use ARC, you have to enable ARC for all files of the adjust SDK. Please consult the [README] for details. diff --git a/doc/mixpanel.md b/doc/mixpanel.md new file mode 100644 index 000000000..a8635f9e3 --- /dev/null +++ b/doc/mixpanel.md @@ -0,0 +1,24 @@ +##Integrate adjust with Mixpanel SDK + +The Mixpanel API allows to register common properties to be sent in all events as `super properties`, as it is explained in the [Mixpanel page][mixpanel_ios]. To integrate adjust with all tracked events of Mixpanel, you must set the `super properties` after receiving the response data of each event. Follow the steps of the [delegate callbacks][response_callbacks] chapter in our iOS SDK guide to implement it. +The delegate function can be set as the following, to use the Mixpanel API: + +```objc +- (void)adjustFinishedTrackingWithResponse:(AIResponseData *)responseData { + Mixpanel *mixpanel = [Mixpanel sharedInstance]; + + // The adjust properties properties will be sent + // with all future track calls. + if (responseData.network != nil) + [mixpanel registerSuperProperties:@{@"[Adjust]Network": responseData.network}]; + if (responseData.campaign != nil) + [mixpanel registerSuperProperties:@{@"[Adjust]Campaign": responseData.campaign}]; + if (responseData.adgroup != nil) + [mixpanel registerSuperProperties:@{@"[Adjust]Adgroup": responseData.adgroup}]; + if (responseData.creative != nil) + [mixpanel registerSuperProperties:@{@"[Adjust]Creative": responseData.creative}]; +} +``` + +[mixpanel_ios]: https://mixpanel.com/help/reference/ios#super-properties +[response_callbacks]: https://github.com/adjust/ios_sdk#9-receive-delegate-callbacks