Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
244 lines (175 sloc) 10.1 KB

Adobe Target - Visual Experience Composer

This extension enables Adobe Target Visual Experience Composer (Target VEC) functionality. The Target VEC for Native Mobile Apps lets you create activities and personalize content on native mobile apps in a do-it-yourself fashion without continuous development dependencies and app-release cycles.

For more information, see:

To get started with Target VEC, complete the following steps:

  1. Configure the Adobe Target - VEC extension.

    The VEC extension is dependent on the Adobe Target Extension. Make sure Adobe Target extension is already configured and enabled.

  2. Add the Target VEC Extension to your app.

  3. Select one of the following implementation methods:

    1. Auto-Fetch Target Activities, where options are:
      • Fetch in a blocking call (background is OFF)
      • Fetch in an asynchronous mode (background is ON)
    2. Fetch Target Activities Programmatically
    3. Handle Target Workspace Restrictions

Configure the Adobe Target - VEC extension in Experience Platform Launch

Adobe Target VEC Extension Configuration

  1. In Experience Platform Launch, click the Extensions tab.

  2. On the Installed tab, locate the Adobe Target VEC extension, and click Configure.

  3. The default configuration options loads Target VEC activities as a blocking call on App launch.

    For more information, see Implementation Methods for Target VEC.

  4. Click Save.

  5. Follow the publishing process to update SDK configuration.

Add Target VEC to your app

{% tabs %} {% tab title="Android" %}

Java

  1. Add Target VEC extension and it's dependencies to your project using the app's Gradle file.

    implementation 'com.adobe.marketing.mobile:target-vec:1.+'
    

    Dependencies

    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'io.github.sac:SocketclusterClientJava:1.7.5'
    implementation 'com.android.support:support-compat:28.0.0'
    implementation 'com.android.support:support-fragment:28.0.0'
  2. Import the Target VEC extension in your application's main activity. import com.adobe.target.mobile.TargetVEC; {% endtab %}

{% tab title="iOS" %}

  1. Import Target and the TargetVEC library.
  2. Add the Target VEC library to your project via your Podfile by adding pod 'ACPTargetVEC'

Objective-C

   #import "ACPCore.h"
   #import "ACPTargetVEC.h"
   #import "ACPTarget.h"

Swift

   #import ACPCore
   #import ACPTarget
   #import ACPTargetVEC

{% endtab %} {% endtabs %}

Register Target VEC with Mobile Core

{% tabs %} {% tab title="Android" %}

Java

After calling the setApplication() method in the onCreate() method, register Target VEC with Mobile Core.

Here is code sample that calls these set up methods:

public class SampleApp extends Application {

 @Override
 public void onCreate() {
     super.onCreate();
     MobileCore.setApplication(this);
     try {
         //Other Extensions that you need
         TargetVEC.registerExtension();
         Target.registerExtension();
         MobileCore.start(new AdobeCallback () {
           @Override
           public void call(Object o) {
               MobileCore.configureWithAppID("YOUR_LAUNCH_ID");
           }
         });
     } catch (Exception e) {
         //Log the exception
     }
 }
}

{% endtab %}

{% tab title="iOS" %}

Objective-C

  1. In your app's didFinishLaunchingWithOptions function register the Target VEC extension
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  //Other Extensions that you need
  [ACPTarget registerExtension];
  [ACPTargetVEC registerExtension];
  [ACPCore start:^{
    [ACPCore lifecycleStart:nil];
  }];
  // Override point for customization after application launch.
  return YES;
}
  1. In your app's openURL method, add the deeplink handling code.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options {
  [ACPCore collectLaunchInfo:@ {@"adb_deeplink": url.absoluteString}];
  return YES;
}

Swift

  1. In your app's didFinishLaunchingWithOptions function register the Target VEC extension
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  //Other Extensions that you need
  ACPTarget.registerExtension()
  ACPTargetVEC.registerExtension()
  ACPCore.start {
    ACPCore.lifecycleStart(nil)
  }
  return true
}
  1. In your app's open url method, add the deeplink handling code.
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
  ACPCore.collectLaunchInfo(["adb_deeplink": url.absoluteString])
  return true
}

{% endtab %} {% endtabs %}

Implementation methods for Target VEC

The Target VEC extension retrieves the relevant Target experiences for your app through a network request. Offers are retrieved via this network call and applied automatically on the targeted screens. No subsequent network requests are made to retrieve VEC experiences as the user navigates through multiple screens of the app.

The default behavior of the extension is to make a synchronous network request (blocking call) at the time of Application launch. You can use Launch to control the behavior of this network request to meet your application behavior.

Auto-Fetch Target Activities

This is the default behavior where a network request is initiated automatically by the Target VEC extension. You can use one of the following options to make this request a blocking call or an asynchronous request.

  • Fetch in a synchronous call (background is OFF)

    When this option is selected, Target VEC extension makes a network request as a blocking call when the app is launched. Offers are applied immediately, and there is no flicker in the app. This is the default behavior of the extension.

  • Fetch in an asynchronous call (background is ON)

    When this option is selected, Target VEC extension makes a network request in the background on App launch but does not block the app from loading. If your experiences are authored on the home screen of your app, the offers might not apply for the home screen if the screen is rendered before the call completes. The app screen rendering is typically identified via the lifecycle events, didFinishLaunchingWithOptions and onActivityResumed, on iOS and Android, respectively. Offers are automatically apply on all subsequent screens.

Fetch Target Activities Programmatically

You can disable the Target VEC extension to make the network request automatically and decide to programmatically call the Extension API. This gives your developers control on how they want to integrate Target VEC offers in the app. The Target VEC extension has the following static methods that can used to programmatically retrieve Target VEC offers:

  • prefetchOffers method hides the current screen until Target VEC offers are fetched.

    The offers are automatically applied to the current screen if applicable and the screen is visible again.

  • prefetchOffersBackground method will not hide the current screen and a call will be made to retrieve the relevant Target offers.

    Target offers are not applied on the current screen, and there will no flicker. As the user navigates to subsequent screens, offers will be automatically applied as applicable.

Handle Target Workspace Restrictions

You can set the at_property value for your workspace using the Launch interface. This ensures only activities in that workspace will be delivered to your mobile app.

Visual preview

Visual preview mode allows you to easily perform end-to-end testing for Target activities by enrolling and previewing these activities on your device. To get started, set up a URL scheme and generate the preview links. For more information, see Target mobile preview.

Tip: This mode does not require a specialized testing set up.

The collectLaunchInfo API is used to enter the visual preview mode. After the visual preview mode is enabled, a red floating button is displayed on the app screen. This button can be pressed to enter the visual preview mode again. For more information, see Collect launch information

{% tabs %} {% tab title="iOS" %}

Syntax

+ (void) collectLaunchInfo: (nonnull NSDictionary*) userInfo;

Objective-C Example

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options {
   [ACPCore collectLaunchInfo:@ {@"adb_deeplink": url.absoluteString}];
   return YES;
}

Swift Example

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
  ACPCore.collectLaunchInfo(["adb_deeplink": url.absoluteString])
  return true
}

{% endtab %} {% endtabs %}

You can’t perform that action at this time.