Reminder - Digital Publishing Suite (DPS) will End of Life on August 31st, 2019. 
Prerequisite knowledge
General web programming knowledge – JavaScript will be discussed.
User level:
Modified: 4/10/2014 (Change log)
Required Adobe products
Note: If you have questions about this article, use the comments feature at the bottom of the article. Please don’t contact technical support with questions about Adobe Developer Connection articles.


With release 29 of Digital Publishing Suite (Phase 1, December 2013), Adobe added Consumer Marketing API additions that enable publishers to track email campaigns, connect Personal Identifiable Information to browser cookies, offer promotional subscriptions, and dynamically message based upon a consumer’s application installations.  Adobe DPS now supports the iOS6 identifierForVendor.  Additionally, you can detect other installed applications and provide custom key/value pairs to your HTML storefront implementations.
This article describes these features and presents possible usage scenarios.
These are all iOS only.

Detecting Other Installed Applications

It can be useful to direct consumers to another installed application or to detect what applications have been installed. With the new ConfigurationService::canOpenUrl() method of the Library and Store SDK, you can safely check whether a target application will open. If not, you may direct the consumer to first download it from the AppStore or skip it all together. The canOpenUrl method takes a URLScheme as input and returns true if the URLScheme is bound to an application. With the canOpenUrl() method, you can detect if specific applications have been installed.
Usage Scenario #1
You want to pass latitude/longitude information (or search info) to Google Maps or other 3rd party mapping provider. If the targeted application is not installed, you do not want to send the user there or indicate that they can open it. So, you first check if canOpenUrl returns true for the mapping app’s URLScheme. Then you know you can safely send the consumer to the other application.
Usage Scenario #2
Cross promote another magazine. Instead of linking out to the app store, first check to see if app is already installed. Then deep link to a specific article within that app, offering a smoother user experience.
Usage Scenario #3
Change your marketing message dynamically based upon what other applications a consumer has installed. For instance, offer them your magazine’s application if they have your competitor’s magazine installed.

iOS Device Identifiers

iOS 6.0 introduced a new identifier (UIDevice::identifierForVendor) that is now accessible from Library and Store SDK via the DeviceService object.”
The advertisingIdentifier provides a common device identifier across all applications regardless of provider. This is very similar to Apple’s original universal device identifier (UDID) with the notable exception that consumers can opt-out. The default setting is to opt-in consumers and can be changed at: Settings->Privacy->Advertising->Limit Ad Tracking. The state of this opt-in is accessible via the isAdvertisingTrackingEnabled property. In order to use this identifier you MUST first enable it by calling the enableAdvertisingFramework. Additionally, Apple stipulates that this identifier must only be used for advertising purposes. If you are not delivering advertising, Apple may reject the application.
Usage Scenario #1
It is now possible to explicitly track which devices have a publisher’s applications installed. This information can be used for targeted advertising.
Because of this, Apple provides the consumer with a way to opt-out AND also to re-generate the identifier on demand.

URLScheme key/value Pairs

You can now pass data to your custom HTML slot. What data is up to you. The general form of the URL is:
So, if in DPS App Builder I assigned my app the URLScheme of “dpsapp” and provided a custom storefront labeled “store”, the URL would be:
If you enter the above into Safari’s address bar on a device with the app installed, the app will be launched and the custom HTML slot labeled ‘store’ would be shown.
From within your HTML/JS code that implements your custom storefront, you have access to a new ApplicationContext class. This contains the following properties:
sourceApplication The iOS Bundle ID of the calling application. For a DPS App, this is the same as applicationId.
Ex: (Safari browser)
urlScheme The URLScheme of your application – just in case you want to know.
urlHost This is always ‘v1’
urlPath The URL path. The value should always be "slot/<slot_name>"
urlQueryString The URL query string variables. This is an object of structure {key:value ...}. It may be undefined as query strings are optional.
Usage Scenario #1
Provide a gift subscription. By forming a URL that contains an authToken, you could automatically authenticate someone to a subscription.
Ex. dpsapp://v1/slot/storefront?authToken=xxxxx
Usage Scenario #2
Track consumer engagement via an email campaign. By directly marketing your application via email, you can track which messages drive the best results.
Ex. dpsapp://v1/slot/storefront?campaignId=xxxxx
Usage Scenario #3
Provide a 50% off coupon code. This is a great way to convert consumers that have downloaded the application, but not subscribed. They key here is to have different subscription product IDs defined within iTunesConnect – but not presented to the consumer unless the coupon is provided.
Ex: dpsapp://v1/slot/storefront?coupon=PROMO50

Open Links in Safari

Hyperlinks and location changes have historically been limited to opening the ‘slide up web view’. This is an internal UIWebView control that animates upon opening and renders the source content. While useful, it is sandboxed to the application and has no access to browser resources.
The DialogService::openExternal method now will open fully qualified (not relative) URLs in the Safari. For publishers that utilize both web browsing and DPS apps, this is a good way to connect information.
Usage Scenario
Set a cookie in Safari that identifies the device. Provide the deviceId, or identifierForVendor as the value of the cookie.
For example, set a cookie with the value of the identifierForVendor using JavaScript:

Where to go from here

Comments are currently closed as we migrate to a new commenting system. In the interim, please provide any feedback using our feedback form. Thank you for your patience.
Change log
4/10/14: Updated information about advertisingIdentifier that changed in the April 7th update of DPS
2/11/14: Updated to reflect changes to APIs with respect to Device Identifiers