diff --git a/src/code-snippets/ios/examples/ADJEvent/addCallbackParameter.mdx b/src/code-snippets/ios/examples/ADJEvent/addCallbackParameter.mdx index ebf9147b1..90645a40a 100644 --- a/src/code-snippets/ios/examples/ADJEvent/addCallbackParameter.mdx +++ b/src/code-snippets/ios/examples/ADJEvent/addCallbackParameter.mdx @@ -9,7 +9,7 @@ Adjust.trackEvent(event) ``` - + ```objc ADJEvent *event = [ADJEvent eventWithEventToken:@"abc123"]; diff --git a/src/code-snippets/ios/examples/ADJEvent/addPartnerParameter.mdx b/src/code-snippets/ios/examples/ADJEvent/addPartnerParameter.mdx index fd6b19b20..32cc97810 100644 --- a/src/code-snippets/ios/examples/ADJEvent/addPartnerParameter.mdx +++ b/src/code-snippets/ios/examples/ADJEvent/addPartnerParameter.mdx @@ -9,7 +9,7 @@ Adjust.trackEvent(event) ``` - + ```objc ADJEvent *event = [ADJEvent eventWithEventToken:@"abc123"]; diff --git a/src/code-snippets/ios/examples/ADJEvent/setCallbackId.mdx b/src/code-snippets/ios/examples/ADJEvent/setCallbackId.mdx index e2413daa1..aa37b4dc8 100644 --- a/src/code-snippets/ios/examples/ADJEvent/setCallbackId.mdx +++ b/src/code-snippets/ios/examples/ADJEvent/setCallbackId.mdx @@ -8,7 +8,7 @@ Adjust.trackEvent(event) ``` - + ```objc ADJEvent *event = [ADJEvent eventWithEventToken:@"abc123"]; diff --git a/src/code-snippets/ios/examples/ADJEvent/setRevenue.mdx b/src/code-snippets/ios/examples/ADJEvent/setRevenue.mdx index 4e75d205a..fcfba0923 100644 --- a/src/code-snippets/ios/examples/ADJEvent/setRevenue.mdx +++ b/src/code-snippets/ios/examples/ADJEvent/setRevenue.mdx @@ -8,7 +8,7 @@ Adjust.trackEvent(event) ``` - + ```objc ADJEvent *event = [ADJEvent eventWithEventToken:@"abc123"]; diff --git a/src/code-snippets/ios/examples/ADJEvent/setTransactionId.mdx b/src/code-snippets/ios/examples/ADJEvent/setTransactionId.mdx index 13f2aa49f..92ecae45f 100644 --- a/src/code-snippets/ios/examples/ADJEvent/setTransactionId.mdx +++ b/src/code-snippets/ios/examples/ADJEvent/setTransactionId.mdx @@ -8,7 +8,7 @@ Adjust.trackEvent(event) ``` - + ```objc ADJEvent *event = [ADJEvent eventWithEventToken:@"abc123"]; diff --git a/src/content/docs/en/sdk/android/features/events.mdx b/src/content/docs/en/sdk/android/features/events.mdx index 1a558c71b..828b9086d 100644 --- a/src/content/docs/en/sdk/android/features/events.mdx +++ b/src/content/docs/en/sdk/android/features/events.mdx @@ -120,6 +120,45 @@ Parameters: currency EUR ``` +### Purchase verification + + + +If you've enabled [purchase verification](https://help.adjust.com/en/article/purchase-verification), you must send additional information with your purchase events to verify them. When Adjust's servers receive this information in an event object, they forward it to Apple to verify the purchase. + + + +`productId` (String) +: The product identifier of the item that was successfully purchased + +`purchaseToken` (String) +: The purchase token generated for your successfully completed in-app purchase + + + + +```kotlin +val adjustEvent = AdjustEvent("abc123") +adjustEvent.setRevenue(6.0, "EUR"); +adjustEvent.setProductId("product-id"); +adjustEvent.setPurchaseToken("purchase-token"); +Adjust.trackEvent(adjustEvent); +``` + + + + +```java +AdjustEvent adjustEvent = new AdjustEvent("abc123"); +adjustEvent.setRevenue(6.0, "EUR"); +adjustEvent.setProductId("product-id"); +adjustEvent.setPurchaseToken("purchase-token"); +Adjust.trackEvent(adjustEvent); +``` + + + + ## Unique events You can pass an optional identifier to avoid recording duplicate events. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs. diff --git a/src/content/docs/en/sdk/ios/features/events.mdx b/src/content/docs/en/sdk/ios/features/events.mdx index 4a870cd46..c1114257a 100644 --- a/src/content/docs/en/sdk/ios/features/events.mdx +++ b/src/content/docs/en/sdk/ios/features/events.mdx @@ -8,8 +8,6 @@ import TrackEvent from "@ios-examples/Adjust/trackEvent.mdx" import TrackEventSig from "@ios-signatures/Adjust/trackEvent.mdx" import SetRevenue from "@ios-examples/ADJEvent/setRevenue.mdx" import SetRevenueSig from "@ios-signatures/ADJEvent/setRevenue.mdx" -import SetTransactionId from "@ios-examples/ADJEvent/setTransactionId.mdx" -import SetTransactionIdSig from "@ios-signatures/ADJEvent/setTransactionId.mdx" import SetCallbackId from "@ios-examples/ADJEvent/setCallbackId.mdx" import SetCallbackIdSig from "@ios-signatures/ADJEvent/setCallbackId.mdx" import AddCallbackParameter from "@ios-examples/ADJEvent/addCallbackParameter.mdx" @@ -60,7 +58,7 @@ class ViewControllerSwift: UIViewController { @implementation ViewControllerObjC - (IBAction)clickRecordSimpleEvent:(UIButton *)sender { - ADJEvent *event = [ADJEvent eventWithEventToken:@"g3mfiw"]; + ADJEvent *event = [ADJEvent eventWithEventToken: @"g3mfiw"]; [Adjust trackEvent:event]; } @@ -187,7 +185,7 @@ class ViewControllerSwift: UIViewController { ``` - + ```objective-c #import "Adjust.h" @@ -245,118 +243,66 @@ class ViewControllerSwift: UIViewController { -```txt title="Event log" {7,8} +```txt title="Event log" {7} Path: /event ClientSdk: ios4.38.0 Parameters: environment sandbox event_count 3 event_token abc123 - revenue 0.25 currency EUR + revenue 0.25 ``` -## Unique events +### Purchase verification -You can pass an optional identifier to avoid recording duplicate events. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs. + -To set the identifier, call the `setTransactionId` method || and pass your transaction ID as a **string** argument. +If you've enabled [purchase verification](https://help.adjust.com/en/article/purchase-verification), you must send additional information with your purchase events to verify them. When Adjust's servers receive this information in an event object, they forward it to Apple to verify the purchase. - + -### Example +`transactionId` (NSString) +: The [`transactionIdentifier` value](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier) of the successfully completed purchase + +`productId` (NSString) +: The product identifier of the item that was successfully purchased -This example shows how to record an event with the token `g3mfiw` whenever a user interacts with a button. The function sets the `uniqueId` to `5e85484b-1ebc-4141-aab7-25b869e54c49` using the `setTransactionId` method || . +`receipt` (NSData) +: The [signed receipt](https://developer.apple.com/documentation/foundation/bundle/1407276-appstorereceipturl) containing the information about the successfully completed purchase ```swift -import Adjust -import UIKit - -class ViewControllerSwift: UIViewController { - @IBOutlet weak var btnRecordEventUnique: UIButton? - - @IBAction func btnRecordEventUnique(_sender: UIButton) { - let event = ADJEvent(eventToken: "g3mfiw"); - let uniqueId = "5e85484b-1ebc-4141-aab7-25b869e54c49"; - event?.setTransactionId(uniqueId); - Adjust.trackEvent(event); - } -} +let receiptURL = Bundle.main.appStoreReceiptURL; +let receipt = try Data(contentsOf: receiptURL, options: .alwaysMapped) + +let event = ADJEvent(eventToken: "abc123") +event?.setRevenue(6.0, currency: "EUR"); +event?.setTransactionId("transaction-id"); +event?.setProductId("product-id"); +event?.setReceipt(receipt); +Adjust.trackEvent(event) ``` -```objective-c -#import "Adjust.h" -#import "Constants.h" -#import "ViewControllerObjC.h" - -@interface ViewControllerObjC () - -@property (weak, nonatomic) IBOutlet UIButton *btnRecordUniqueEvent; - -@end - -@implementation ViewControllerObjC - -- (IBAction)clickRecordUniqueEvent:(UIButton *)sender { - ADJEvent *event = [ADJEvent eventWithEventToken:@"g3mfiw"]; - [event setTransactionId:@"5e85484b-1ebc-4141-aab7-25b869e54c49"]; - [Adjust trackEvent:event]; -} - -@end -``` - - - - -```html - - - -
-
- -
-
- - +```objc +NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; +NSData *receipt = [NSData dataWithContentsOfURL:receiptURL]; +ADJEvent *event = [ADJEvent eventWithEventToken::@"your-event-token"]; +[event setRevenue:6.0 currency:@"EUR"]; +[event setTransactionId:@"transaction-id"]; +[event setProductId:@"product-id"]; +[event setReceipt:receipt]; +[Adjust trackEvent:event]; ```
-```txt title="Event log" {7} -Path: /event -ClientSdk: ios4.38.0 -Parameters: - environment sandbox - event_count 3 - event_token abc123 - transaction_id 5e85484b-1ebc-4141-aab7-25b869e54c49 -``` - ## Add callback parameters If you [register a callback URL](https://help.adjust.com/en/article/set-up-callbacks) in the Adjust dashboard, the SDK sends a GET request to your callback URL when it records an event. @@ -695,12 +641,12 @@ class ViewControllerSwift: UIViewController {
-```txt title="Event log" {7} +```txt title="Event log" {4} Path: /event ClientSdk: ios4.38.0 Parameters: + callback_id f2e728d8-271b-49ab-80ea-27830a215147 environment sandbox - event_count 3 + event_count 1 event_token g3mfiw - callback_id f2e728d8-271b-49ab-80ea-27830a215147 ``` diff --git a/src/content/docs/en/sdk/unity/features/events.mdx b/src/content/docs/en/sdk/unity/features/events.mdx index 10260d28e..d2e014bfe 100644 --- a/src/content/docs/en/sdk/unity/features/events.mdx +++ b/src/content/docs/en/sdk/unity/features/events.mdx @@ -127,6 +127,37 @@ Parameters: currency EUR ``` +### Purchase verification + + + +If you've enabled [purchase verification](https://help.adjust.com/en/article/purchase-verification), you must send additional information with your purchase events to verify them. When Adjust's servers receive this information in an event object, they forward it to Apple to verify the purchase. + + + +`productId` (String) +: The product identifier of the item that was successfully purchased + +`transactionId` (NSString) +: The [`transactionIdentifier` value](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier) of the successfully completed purchase. iOS only + +`receipt` (String) +: The signed receipt containing the information about the successfully completed purchase. iOS only + +`purchaseToken` (String) +: The purchase token generated for your successfully completed in-app purchase. Android only + +```cs +AdjustEvent adjustEvent = new AdjustEvent("abc123"); +adjustEvent.setRevenue(6.0, "EUR"); +adjustEvent.setProductId("product-id"); // Android & iOS +adjustEvent.setTransactionId("transaction-id"); // iOS only +adjustEvent.setReceipt("receipt"); // iOS only +adjustEvent.setPurchaseToken("purchase-token"); // Android +only +Adjust.trackEvent(adjustEvent); +``` + ## Unique events You can pass an optional identifier to avoid recording duplicate events. The SDK stores the last ten identifiers and skips revenue events with duplicate transaction IDs.