Visual Experience Composer best practices and limitations
To ensure your experiences function as intended, follow best practices when using the ÃÛ¶¹ÊÓÆµ Target Visual Experience Composer (VEC). Be aware of key tips and limitations to maximize performance and avoid common issues.
Best Practices section_86CF28C99CFF40329E4CBAFE4DD78BB4
The following are best practices when using the VEC:
Place the at.js reference at the top of the <head>
section of your page.
You can enable the Enhanced Experience Composer at the account level (enabled for all activities created in the account) or at the individual activity level.
To enable the Enhanced Experience Composer at the account level, click Administration > Visual Experience Composer, then toggle the Enable Enhanced Experience Composer switch to the On position.
To enable the Enhanced Experience Composer at the activity level while creating an activity in the Visual Experience Composer, click Configure > Page Delivery, then toggle the Enable Enhanced Experience Composer switch to the On position.
You can allowlist certain IP addresses if the Enhanced Experience Composer won’t load on secure pages on your site.
Problems loading the Enhanced Experience Composer can be resolved by allowlisting the following IP addresses. These IP addresses are for ÃÛ¶¹ÊÓÆµ servers used for the Enhanced Experience Composer proxy. They are only required for activity editing. Visitors to your site do not need these IP addresses allowlisted.
For more information, see The EEC won’t load an internal QA URL that is not accessible on public IP in Troubleshooting issues related to the Enhanced Experience Composer.
Use unique IDs for top-level elements and any other elements that could be good testing/targeting candidates.
Anything immediately inside the body element should have a unique ID. If new elements are injected into the body and code moves around, at least the parent elements have an easier way to be recognized.
Target does not require IDs, but using IDs increases the reliability of experiences created with the experience composer. Target uses CSS selectors to modify your content when the experience is delivered. When you edit an experience, the Visual Experience Composer anchors the selector to the closest ancestor with a non-null ID attribute to the HTML element being modified. It is, therefore, not advisable to use any mechanism, including JavaScript libraries, that sets or modifies HTML ID attributes. Although those IDs might be available to the Target experience composer for activity creation, if JavaScript modifies IDs, the ID that was used when the experience was created might not be available when the experience runs. If an ID is not available, the selector anchored to the ID fails.
Name CSS classes so they are easily identifiable.
When editing CSS classes in the Visual Experience Composer, it is helpful to make the classes easy to identify by using descriptive class names. This helps to ensure that you edit the right CSS classes, and your pages appear as expected.
Don’t use the !important
CSS property when hiding or removing elements.
If the !important
CSS property is present, changes made by target.js
during delivery is overridden by the site’s CSS rules.
Avoid using HTML tables for page layouts.
Minimize the use of iFrames.
Attempt to arrange all dynamic DOM modifications as soon after DOM ready as possible.
target.js
, content delivery could be broken. This happens only when there is a DOM change in the hierarchy of a targeted element.Use only plain text or an image tag in your anchor elements.
<a>Anchor Text</a>
OR
<a href="/"> <img src=""> </img> </a>
Avoid block-level elements inside an inline element.
Don’t use the base tag in your website to resolve URLs and links.
Using EDIT HTML to manipulate DOM structure can break selectors.
For example, if you have taken two actions:
- Added a class to Element 1
- Edited the HTML for Element 1
Each change creates a new element in the VEC. Because the second action modifies Element 1, if you delete Element 1, the second action no longer has anything to modify, so the change no longer works.
In other words, if you add an element with text, then in a separate action you edit that element with different text, the code editor shows both actions as separate elements. When you edited the element, you created a new element that modifies the original one you created, containing the edited text. If you then delete the original element, the edited text won’t be able to find the element that was edited, and will not display. The second element remains in the list of elements, but it does not affect the page because the element it changes no longer exists.
See Element Selectors Used in the Visual Experience Composer.
Use <b>
and <i>
tags when styling text elements with the rich-text editor.
- For bold text, use
<b>
rather than<strong>
. - For italic text, use
<i>
rather than<em>
.
<strong>
and <em>
tags might cause unexpected results.
Be careful when removing form fields.
Do not include mboxCreate
inside scripts.
mboxCreate
uses document.write
, it is not recommended to include mboxCreate
in scripts. Instead, use mboxDefine
and mboxUpdate
for the same purpose.Don’t update an HTML snippet using Target if it requires JavaScript code for its initialization.
When an action (Edit HTML) is performed on page components (such as sliders, carousels, and so on), delivery might appear broken. The VEC performs the action after the page component has been instantiated by JavaScript.
However, when the content of the page is delivered to visitors, the action is applied before instantiation of the component. Because of this, this component’s functionality may or may not break at the time of delivery. Functionality depends on the nature of the script used on his page to define the component.
If you test for delivery and it works the first time, it is not guaranteed that it will continue working. There may (or may not) be a race condition.
- If there is a race condition, delivery works intermittently.
- If there is no race condition, delivery always works.
Test your page multiple times to make sure delivery works as expected.
Don’t use a base tag in your website to resolve URLs and links.
Important text on the site that might be used for targeting should be kept in HTML code within an element.
For example, you cannot target Shopping Cart text in the VEC if your code is like the following:
code language-html |
---|
|
In this example, the entire anchor element is selected in the VEC, which adversely affects other elements if targeting is performed.
Don’t use top
or self
variables in JavaScript code.
Always test your website if parameters are added when loading the page.
For example, to open www.abc.com
, the following URL parameters are used:
www.abc.com?mboxEdit=1&mboxDisable=1
These parameters enable editing in an iframe.
Make sure your website loads as expected after adding parameters like these.
Make sure your page opens as expected in an iframe.
Turn OFF iframe busting techniques on your website and check whether the website opens as expected within an iframe on a dummy page. For example:
code language-html |
---|
|
Caveats section_A0436B7B85BA467FA9DE13A9A40E6A6E
Consider the following caveats when using the Visual Experience Composer to design your activity.
The Move feature does not support z-index.
Rearranging elements affects click tracking.
If an element marked for click tracking is rearranged, the paths of the rearranged elements are changed. As a result, the element in the location where the original element was before it was rearranged is the one whose clicks are tracked.
This occurs because both the code to deliver the activity content and the code to track clicks is included in one piece of code that is delivered to the page. If you browse to a different page and set up click tracking, then the activity content code and the click tracking code are delivered to that page. If the click-tracking page has a similar page structure to the page where the test is run, then the test content might also appear on the click-tracking page.
Inserting an element might not work in a <div>
that is an mbox.
insertBefore
and not insertAfter
, if the mbox is implemented incorrectly.When editing both a parent and child element, edit the parent first.
Cannot select page element that includes an mbox as a child element.
For example, if your page contains:
code language-html |
---|
|
The outer div should not be selected in an experience because the mbox hardcoded in the page still makes a call to Target and receives a response. This response interferes with the response intended for the larger page element.
Proxy IPs might be blocked in customers environment.
Limitations section_F33C2EA27F2E417AA036BC199DD6C721
Consider the following limitations when working with the VEC:
Handling VEC compatibility with Chrome extension policy changes. ext
Due to updated , extensions can no longer modify the original DOM before it is parsed by the browser. As a result, certain security scripts—such as iframe-busting implementations—might block pages from loading in the VEC.
To ensure compatibility, these scripts should be conditionally disabled when the page is loaded inside the Target iframe. This process can be safely done by checking for the presence of the window.adobeVecExtension
object, which is injected by Target during VEC loading.
The following code snippets are examples of iframe-busting code that can lead to web page not loading in the VEC:
window.top.location = window.self.location;
top.location.href = self.location.href;
A simple check can be used to verify when a web page is embedded inside Target. A code snippet should look like this:
code language-none |
---|
|
You cannot move an element outside a container followed by a CSS property.
You cannot select the Button element for rearranging.
Only swap offers are available on mboxes.
You should not rearrange and move the same element.
The Change Image action does not work on an image in a carousel.
If, for example, your page contains a carousel with six images and you want to swap an image with the second image of the carousel, the Change Image action does not work.
The workaround is to select the parent container and use the Edit HTML action to edit the HTML of the carousel to update the image source of the desired image.
Images cannot be resized in an mbox.
After you swap an image, you cannot select the Edit action.
HTML elements with an external source cannot be edited.
Click tracking does not work for anchor elements that contain anything other than plain text or image tags.
Pages must accept URL parameters for the VEC to work.
While using a script as part of HTML, any variables and functions that are accessed from outside should be declared under the window namespace.
The script is executed within the scope of target.js
after the page loads. Therefore, any variable or function that is declared locally is not accessible from outside the script block.
Incorrect:
code language-html |
---|
|
Correct:
code language-html |
---|
|
Inserting an image from the Content library (Scene7) and editing the HTML breaks the image URL.
Add an anchor element inside the ‘customHeaderMessage’ div with some dummy text:
code language-html |
---|
|
Select this div using the Insert Element action to insert a image as a sibling of this dummy text div.
After image insertion, it looks like:
code language-html |
---|
|
Remove the dummy text span.
The customCode
action in the VEC does not work with Internet Explorer 8.
target.js
does not support this in IE8. As a workaround, if the page contains jQuery and is exposed on the window object globally, target.js
can use deliver the customCode
action. Ensure that window.jQuery
and window.jQuery.fn.prepend
are defined.