Java
To append visitor information to the URL that is being used to open the web view, call appendVisitorInfoForUrl:
Copied to your clipboardIdentity.appendVisitorInfoForURL("https://example.com", new AdobeCallback<String>() {@Overridepublic void call(String urlWithAdobeVisitorInfo) {//handle the new URL here//For example, open the URL on the device browser//Intent i = new Intent(Intent.ACTION_VIEW);i.setData(Uri.parse(urlWithAdobeVisitorInfo));startActivity(i);}});
Alternately, starting in SDK version 1.4.0 (Identity version 1.1.0), you can call getUrlVariables and build your own URL:
Copied to your clipboardIdentity.getUrlVariables(new AdobeCallback<String>() {@Overridepublic void call(String stringWithAdobeVisitorInfo) {//handle the URL query parameter string here//For example, open the URL on the device browser//Intent i = new Intent(Intent.ACTION_VIEW);i.setData(Uri.parse("https://example.com?" + urlWithAdobeVisitorInfo));startActivity(i);}});
To append visitor information to the URL that is being used to open the web view, call appendToUrl:
Swift
Copied to your clipboardlet url = URL(string: "https://example.com")Identity.appendTo(url: url) { appendedUrl, error inif error != nil {// handle error here} else {// handle appended url here}}
Objective-C
Copied to your clipboardNSURL *sampleUrl = [NSURL URLWithString:@"https://example.com"];[AEPMobileIdentity appendToUrl:sampleUrl completion:^(NSURL * _Nullable appendedUrl, NSError *error) {if (error != nil) {// Handle error here} else {// Handle appended url here}}];
Alternately, you can call getUrlVariables and build your own URL:
Swift
Copied to your clipboardIdentity.getUrlVariables { urlVariables, error inif error != nil {// handle error here} else {if let url = URL(string: "https://example.com?\(urlVariables ?? "")") {DispatchQueue.main.async {UIApplication.shared.open(url)}}}}
Objective-C
Copied to your clipboard[AEPMobileIdentity getUrlVariables:^(NSString * _Nullable urlVariables, NSError *error) {NSString *sampleURLString = @"https://example.com";if (error != nil) {// Handle variables being nil} else {NSString *stringWithData = [NSString stringWithFormat:@"%@?%@", sampleURLString, urlVariables];NSURL *appendedUrl = [NSURL URLWithString:stringWithData];dispatch_async(dispatch_get_main_queue(), ^{[[UIApplication sharedApplication] openURL:appendedUrl options:@{} completionHandler:nil];});}}];