Adobe Target for TVML/TVJS
Leverage Adobe Target in your TVML/TVJS apps by making direct replacements to your .xml files. Designate areas of your page to be replaced by content from Target by using the custom xml element ADBTarget.
This section contains the following information:
- Getting Started
- Configuring Your Mbox in Target
- Configuring Your ADBTarget Element
Prior to using the ADBTarget element in your TVML pages, you must configure your TVML/TVJS app to use the tvOS SDK.
For mor information, see Apple TV Implementation with tvOS.
- Identify the .xml file in which you want to use your Target location.
- Add an ADBTarget element to that file as a child of the <document> element.
- If Target fails to find your Mbox location or it times out, the value between your <ADBTarget> and </ADBTarget> tags are used as default content.
The returned content from Target replaces all content between <ADBTarget> and </ADBTarget> (including both ADBTarget tags). You should plan what you want to replace accordingly. Your use case might be as simple as replacing a string value in a label or as complex as replacing an entire page.
In the ADBTarget element, you must provide the Mbox name in the mbox property. Optionally, add custom properties to your request in the customParameterName="customParameterValue" format.
|Property Name||Property Type||Property Value||Required?|
|mbox||String||Name of your Mbox location||Yes|
|purchasedProductIds||String||Comma separated list of purchased product ids for this order.
List of key-value pairs for mboxParameters. Each entry in this string is separated by a semicolon ' ; ' and key-values are separated by a colon ' : '.
Example 1: The following example uses an ADBTarget element in a page named LandingPage.xml.js to replace the contents of an alert:
Assume that you have an Mbox location created named "landingPage" and the offer content is set to be the following:
<title>My cool landing page</title> <description>Thanks for coming to my page</description>
<alertTemplate> <ADBTarget mbox="landingPage"> <title>TargetTestPage</title> <description>Load fail or timeout (defaultContent)</description> </ADBTarget> </alertTemplate>
If the request to Target is successful and your offer content is returned, your page will result with:
<alertTemplate> <title>My cool landing page</title> <description>Thanks for coming to my page</description> </alertTemplate>
If the Target server cannot be reached or the request times out, your page will result with:
<alertTemplate> <title>TargetTestPage</title> <description>Load fail or timeout (defaultContent)</description> </alertTemplate>
Example 2: The following example demonstrates adding custom data to your ADBTarget element. This method lets you create conditional experiences (and offer content) for this Mbox location in Target:
<alertTemplate> <ADBTarget mbox="landingPage" customData="custom data" moreCustomData="more custom data"> <title>TargetTestPage</title> <description>Load fail or timeout (defaultContent)</description> </ADBTarget> </alertTemplate>
Parent topic: Apple TV Implementation with tvOS