Sur cette page : découvrez les bonnes pratiques, les avertissements et les limites à connaître lors de la création d’expériences dans le Compositeur d’expérience visuelle (VEC).
Le respect de ces pratiques permet de créer des expériences dans le Adobe Target compositeur d’expérience visuelle (VEC) comme prévu. Les avertissements et les limitations décrivent les comportements qui peuvent provoquer des problèmes courants. En conséquence, les connaître permet d’éviter les problèmes et de maintenir les performances.
Bonnes pratiques best-practices
Les pratiques suivantes s’appliquent lors de l’utilisation du compositeur d’expérience visuelle.
Activer le compositeur d’expérience amélioré enable-eec
Le compositeur d’expérience amélioré peut être activé au niveau du compte, ce qui l’active pour toutes les activités créées dans le compte, ou au niveau de chaque activité.
- Niveau du compte : Cliquez sur Administration > Compositeur d’expérience visuelle, puis activez le bouton (bascule) Activer le compositeur d’expérience amélioré en position Activé.
- Niveau d’activité : lors de la création d’une activité dans le compositeur d’expérience visuelle, cliquez sur Configurer > Diffusion de page, puis activez le bouton (bascule) Activer le compositeur d’expérience amélioré sur la position Activé.
Mise en page et chargement
<head> de la page.top ou self dans le code JavaScript.top et self sont mises à jour afin de désactiver le contournement d’iframe. Utilisez un en-tête X-Frame-Options pour ajouter le démantèlement d’iframe au lieu du code JavaScript personnalisé.Par exemple, les paramètres d’URL suivants sont utilisés pour ouvrir www.abc.com en vue de le modifier dans un iframe :
www.abc.com?mboxEdit=1&mboxDisable=1
Assurez-vous que le site web se charge comme prévu après l’ajout de paramètres tels que ceux-ci.
Désactivez les techniques de suppression d’iframe sur le site web et vérifiez si le site web s’ouvre comme prévu dans un iframe sur une page factice. Par exemple :
| code language-html |
|---|
|
Balisage de page
Tout ce qui se trouve immédiatement à l’intérieur de l’élément de corps doit avoir un identifiant unique, de sorte qu’au moins les éléments parents soient faciles à reconnaître lorsque de nouveaux éléments sont injectés dans le corps et que le code se déplace.
Target ne nécessite pas d’identifiants, mais les identifiants augmentent la fiabilité des expériences créées avec le compositeur d’expérience. Target utilise des sélecteurs CSS pour modifier le contenu lors de la diffusion de l’expérience. Lorsqu’une expérience est modifiée, le compositeur d’expérience visuelle ancre le sélecteur à l’ancêtre le plus proche de l’élément HTML modifié dont l’attribut d’ID n’est pas nul. Il n’est donc pas recommandé d’utiliser un mécanisme, y compris les bibliothèques JavaScript, qui définit ou modifie les attributs d’HTML ID. Ces identifiants peuvent être disponibles pour le compositeur d’expérience lors de la création de l’activité, mais si JavaScript les modifie, les identifiants utilisés lors de la création peuvent ne pas être disponibles lors de l’exécution de l’expérience. Si aucun identifiant n’est disponible, le sélecteur ancré à cet identifiant échoue.
!important lors du masquage ou de la suppression d’éléments.!important est présente, les règles CSS du site remplacent les modifications apportées par target.js lors de la diffusion.Un élément d’ancrage contient du texte brut :
<a>Anchor Text</a>
ou une balise d’image :
<a href=""> <img src=""> </img> </a>
Par exemple, le texte Panier ne peut pas être ciblé dans le VEC si le code est similaire à ce qui suit :
| code language-html |
|---|
|
Dans cet exemple, l’élément d’ancrage entier est sélectionné dans le compositeur d’expérience visuelle, ce qui a une incidence négative sur les autres éléments si le ciblage est effectué.
Edition et diffusion
target.js n’applique l’expérience, la diffusion de contenu peut être interrompue. Cela ne se produit qu’en cas de modification du DOM dans la hiérarchie de l’élément ciblé.Par exemple, deux actions sont entreprises :
- Une classe est ajoutée à l’élément 1.
- L’HTML de l’élément 1 est modifiée.
Chaque modification crée un élément dans le compositeur d’expérience visuelle. La deuxième action modifie l’élément 1. Par conséquent, si l’élément 1 est supprimé, la deuxième action n’a plus rien à modifier et la modification ne fonctionne plus.
De même, si un élément est ajouté avec du texte et qu’une action distincte modifie ensuite cet élément avec un texte différent, l’éditeur de code affiche les deux actions sous la forme d’éléments distincts. L’édition crée un nouvel élément qui modifie l’élément d’origine et contient le texte modifié. Si l’élément d’origine est ensuite supprimé, le texte modifié ne trouve pas l’élément à modifier et ne s’affiche pas. Le deuxième élément reste dans la liste des éléments, mais il n’a aucun effet sur la page, car l’élément qu’il modifie n’existe plus.
Voir Sélecteurs d’éléments utilisés dans le compositeur d’expérience visuelle.
<b> et <i> lors du style d’éléments de texte avec l’éditeur de texte enrichi.- Pour mettre le texte en gras, utilisez
<b>plutôt que<strong>. - Pour mettre le texte en italique, utilisez
<i>plutôt que<em>.
Les balises <strong> et <em> peuvent entraîner des résultats inattendus.
mboxCreate dans les scripts.mboxCreate utilise document.write, il n’est donc pas recommandé de l’inclure dans les scripts. Utilisez mboxDefine et mboxUpdate dans le même but.Lorsqu’une action (Modifier HTML) est effectuée sur des composants de page tels que des curseurs et des carrousels, la diffusion peut sembler endommagée. Le compositeur d’expérience visuelle effectue l’action après l’instanciation du composant de page par JavaScript. Cependant, lorsque le contenu de la page est diffusé aux visiteurs, l’action est appliquée avant l’instanciation du composant. Par conséquent, la fonctionnalité du composant peut être interrompue ou non au moment de la diffusion, selon le script qui définit le composant sur la page.
Un test de diffusion qui fonctionne la première fois ne garantit pas que la diffusion continuera à fonctionner, car une condition de concurrence peut exister :
- S’il existe une condition de concurrence, la diffusion fonctionne par intermittence.
- S’il n’existe aucune condition de concurrence, la diffusion fonctionne toujours.
Testez la page plusieurs fois pour vous assurer que la diffusion fonctionne comme prévu.
Avertissements caveats
Les avertissements suivants s’appliquent lors de l’utilisation du compositeur d’expérience visuelle pour concevoir une activité.
Si un élément marqué pour le suivi des clics est réorganisé, les chemins des éléments réorganisés changent. Par conséquent, les clics sont suivis sur l’élément à l’emplacement où se trouvait l’élément d’origine avant sa réorganisation.
Cela se produit, car le code qui diffuse le contenu de l’activité et le code qui suit les clics sont inclus dans un élément de code qui est diffusé à la page. Si une autre page est accessible et que le suivi des clics y est configuré, les deux éléments de code sont envoyés à cette page. Si la page de suivi des clics présente une structure de page similaire à celle de la page sur laquelle s’exécute le test, le contenu du test peut également s’afficher sur la page de suivi des clics.
<div> qui est une mbox.insertBefore et non sous la forme insertAfter.Par exemple, si la page contient le code suivant :
| code language-html |
|---|
|
La balise div externe ne doit pas être sélectionnée dans une expérience, car la mbox codée en dur dans la page effectue toujours un appel à Target et reçoit une réponse. Cette réponse interfère avec la réponse prévue pour l’élément de page plus grand.
Limites section_F33C2EA27F2E417AA036BC199DD6C721
Les restrictions suivantes s’appliquent lorsque vous utilisez le compositeur d’expérience visuelle.
Exigences de page
Dans le cadre des politiques de manifeste V3 mises à jour dans Google Chrome, les extensions ne peuvent plus modifier le DOM d’origine avant que le navigateur ne l’analyse. Par conséquent, certains scripts de sécurité, tels que les implémentations qui démolissent un iframe, peuvent bloquer le chargement des pages dans le VEC.
Pour garantir la compatibilité, désactivez ces scripts de manière conditionnelle lorsque la page est chargée dans l’iframe Target. Vous pouvez le faire en toute sécurité en vérifiant la présence de l’objet window.adobeVecExtension, que Target injecte pendant le chargement du VEC.
Les fragments de code suivants sont des exemples de code qui démolissent un iframe et peuvent empêcher le chargement d’une page web dans le VEC :
window.top.location = window.self.location;
top.location.href = self.location.href;
Une simple vérification peut vérifier si une page web est incorporée dans Target. Le fragment de code ressemble à ceci :
| code language-none |
|---|
|
Le script est exécuté dans la portée de target.js après le chargement de la page. Par conséquent, toute variable ou fonction déclarée localement n’est pas accessible de l’extérieur du bloc de script.
Incorrect :
| code language-html |
|---|
|
Correct :
| code language-html |
|---|
|
customCode dans le VEC ne fonctionne pas avec Internet Explorer 8.target.js ne prend pas en charge cette action dans IE8 en raison des limitations d’IE8 lors de la gestion du contenu du script. Pour pallier ce problème, si la page contient jQuery et que jQuery est exposé globalement sur l’objet de fenêtre, target.js peut exécuter l’action customCode. Assurez-vous que window.jQuery et window.jQuery.fn.prepend sont définis.Réorganisation des mbox et
Un élément ne peut pas être déplacé en dehors d’un conteneur suivi d’une propriété CSS.
Images
Par exemple, si la page contient un carrousel avec six images et qu’une image doit être permutée avec la deuxième image du carrousel, l’action Modifier l’image ne fonctionne pas.
Pour pallier ce problème, sélectionnez le conteneur parent et utilisez l’action Modifier HTML pour modifier l’HTML du carrousel et mettre à jour la source d’image de l’image souhaitée.
Ajoutez un élément d’ancrage dans la balise div customHeaderMessage avec un texte factice :
| code language-html |
|---|
|
Sélectionnez cette balise div à l’aide de l’action Insérer l’élément pour insérer une image en tant que frère du texte factice.
Une fois l’image insérée, le code se présente comme suit :
| code language-html |
|---|
|
Supprimez l’élément span de texte de remplissage.
Suivi des clics et contenu externe
This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.
For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.
- TL;DR: Lists the best practices, caveats, and limitations to be aware of when creating experiences in the Visual Experience Composer (VEC).
Intents:
- Apply the best practices for page setup and loading so that experiences created in the VEC function as intended.
- Structure page markup (IDs, CSS class names, layouts, anchor elements) so that experiences created with the experience composer are reliable.
- Avoid editing and delivery problems, such as broken selectors or delivery that appears broken for page components such as sliders and carousels.
- Identify the caveats that apply when using the VEC to design an activity.
- Identify the limitations of the VEC for page requirements, rearranging and mboxes, images, and click tracking.
Glossary:
window.adobeVecExtension(product-specific): object that Target injects while the VEC loads.
Guardrails:
- Move feature: the Move feature does not support z-index, so a moved element cannot be placed on top of another element.
- Click tracking and rearranging: if an element marked for click tracking is rearranged, the paths of the rearranged elements change, and clicks are tracked on the element in the location where the original element was before it was rearranged.
- Insert element in an mbox: inserting an element might not work in a
<div>that is an mbox. If an mbox contains an offer and the mbox is implemented incorrectly, an inserted element might appear asinsertBeforeand not asinsertAfter. - Page element that includes an mbox as a child element: do not select such an element, because the mbox hardcoded in the page still makes a call to Target and receives a response that interferes with the response intended for the larger page element.
- Chrome V3 Manifest policies: extensions can no longer modify the original DOM before the browser parses it, so certain security scripts, such as iframe-busting implementations, might block pages from loading in the VEC. To ensure compatibility, these scripts can be conditionally disabled when the page is loaded inside the Target iframe, by checking for the presence of
window.adobeVecExtension. - URL parameters: pages must accept URL parameters for the VEC to work. Some sites strip any URL parameters from their pages, but the VEC requires those parameters.
- Scripts used as part of HTML: any variable or function that is accessed from outside must be declared under the window namespace, because the script is executed within the scope of
target.jsafter the page loads, so a variable or function declared locally is not accessible from outside the script block. customCodeaction: does not work with Internet Explorer 8, becausetarget.jsdoes not support this action in IE8 because of IE8 limitations when handling script content. As a workaround, if the page contains jQuery and jQuery is exposed globally on the window object,target.jscan deliver thecustomCodeaction; make sure thatwindow.jQueryandwindow.jQuery.fn.prependare defined.- Rearranging: an element cannot be moved outside a container that is followed by a CSS property.
- Button element: Button elements cannot be selected directly for rearranging. To enable rearrangement, place the buttons inside a larger container.
- Rearranging and moving: do not rearrange and move the same element. If an element has been moved to another location and the parent container is then selected to rearrange the child elements, the moved element is not affected and remains where it is, and the rearrangement might not appear as desired.
- mboxes: only swap offers are available on mboxes. Actions such as Edit Class and Rearrange are not allowed inside an mbox.
- Change Image action: does not work on an image in a carousel. As a workaround, select the parent container and use the Edit HTML action to edit the HTML of the carousel and update the image source of the desired image.
- Image resizing in an mbox: if an image is swapped in an mbox element and then resized according to the size of the mbox element, the resizing is not permitted. Images cannot be resized in an mbox.
- Edit action after an image swap: after an image is swapped, the Edit action cannot be selected and the Scene7 URL cannot be edited.
- Content library (Scene7): inserting an image from the Content library (Scene7) and editing the HTML breaks the image URL.
- Click tracking on anchor elements: click tracking does not work for anchor elements that contain anything other than plain text or image tags, for example when the element contains JavaScript.
- Click tracking pages: click tracking is supported only on the page on which experiences are created or on the redirected page. Browse mode is available for click tracking in the VEC, but Browse mode cannot be used to add click tracking on a page.
- External source: HTML elements with an external source, for example video, audio tags, embed, iFrames, and frames, cannot be edited.
Terminology:
- Canonical name: Visual Experience Composer
- Acronym: VEC (Visual Experience Composer)
- Variant: experience composer
- Canonical name: Enhanced Experience Composer
FAQ:
- Where can I enable the Enhanced Experience Composer? It can be enabled at the account level, which enables it for all activities created in the account (Administration > Visual Experience Composer, then toggle the Enable Enhanced Experience Composer switch to the On position), or at the individual 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).
- Where should the at.js reference be placed on the page? Place the at.js reference at the top of the
<head>section of the page. If the Visitor API Service is also used, place the Visitor API script above at.js. - Why should the base tag not be used in the website? The VEC, including the Enhanced Experience Composer, manipulates the website behind the scenes through a proxy server that updates all link URLs to make them work in the proxy. If a base tag is added, the browser resolves these URLs again, so they appear broken.
- Which actions are available on mboxes? Only swap offers are available on mboxes. Actions such as Edit Class and Rearrange are not allowed inside an mbox.
- Does click tracking work for anchor elements that contain JavaScript? No. Click tracking does not work for anchor elements that contain anything other than plain text or image tags.
- What can be done when the Change Image action does not work on an image in a carousel? Select the parent container and use the Edit HTML action to edit the HTML of the carousel and update the image source of the desired image.
Troubleshooting:
- The Enhanced Experience Composer does not load on secure pages of the site: allowlist the IP addresses of the Adobe servers used for the Enhanced Experience Composer proxy to resolve loading problems. These IP addresses are required only for activity editing; visitors to the site do not need them allowlisted.
- Timeouts and access denied errors: these might occur if the Enhanced Experience Composer is used on a non-live site, such as a staging environment, and the site blocks the proxy IP addresses.
Examples:
- URL parameters added when the page loads:
www.abc.com?mboxEdit=1&mboxDisable=1are the URL parameters used to openwww.abc.comfor editing in an iframe. - Shopping Cart text that cannot be targeted in the VEC: an anchor element (
<a>) that contains an<img alt="Shopping Cart">tag, the text “Shopping Cart:” and<span>elements for the quantity and price. In this example, the entire anchor element is selected in the VEC, which adversely affects other elements if targeting is performed. - Iframe-busting code that can prevent a web page from loading in the VEC:
window.top.location = window.self.location;andtop.location.href = self.location.href;. - Declaring variables and functions under the window namespace when a script is used as part of HTML: use
window.myVar = 123;andwindow.myFunc = function() { };(correct) instead ofvar myVar = 123;andfunction myFunc() { }(incorrect).
Best practices:
- Enable the Enhanced Experience Composer, at the account level or at the individual activity level.
- Place the at.js reference at the top of the
<head>section of the page. If the Visitor API Service is also used, place the Visitor API script above at.js. - Do not use the base tag in the website to resolve URLs and links.
- Do not use the
toporselfvariables in JavaScript code. When the Enhanced Experience Composer is enabled, the values of thetopandselfvariables are updated to disable iframe busting; use an X-Frame-Options header to add iframe busting instead of custom JavaScript code. - Always test the website if parameters are added when the page loads, and make sure that the website loads as expected after adding such parameters.
- Make sure that the page opens as expected in an iframe: turn off iframe busting techniques on the website and check whether the website opens as expected in an iframe on a dummy page.
- Use unique IDs for top-level elements and for any other elements that are good testing or targeting candidates. Anything immediately inside the body element should have a unique ID. Target does not require IDs, but IDs increase the reliability of experiences created with the experience composer. It is not advisable to use any mechanism, including JavaScript libraries, that sets or modifies HTML ID attributes, because if an ID is not available when the experience runs, the selector anchored to that ID fails.
- Use descriptive CSS class names, so that the classes are easy to identify when CSS classes are edited in the VEC.
- Do not use the
!importantCSS property when hiding or removing elements, because the CSS rules of the site override the changes thattarget.jsmakes during delivery. - Avoid HTML tables for page layouts. Target uses JavaScript to format a page, and table-based layouts are difficult to modify with JavaScript and might not display the same way in all browsers. For best results, use CSS to create page layouts.
- Minimize the use of iFrames. The VEC can apply some actions within an iFrame, but some actions, such as resizing, do not work properly.
- Use only plain text or an image tag in anchor elements.
- Avoid block-level elements inside an inline element, such as anchor and span elements, because the inline elements lose their height and width, so the overlay tool in the VEC might not work as expected.
- Be careful when removing form fields, because certain form fields might be mandatory for submission.
- Keep important text that might be used for targeting in the HTML code within an element.
- Arrange all dynamic DOM modifications as soon after DOM ready as possible. If the modifications fail to apply before
target.jsapplies the experience, content delivery could be broken. This happens only when there is a DOM change in the hierarchy of a targeted element. - Using Edit HTML to manipulate the DOM structure can break selectors: each change creates a new element in the VEC, so if the element that an earlier action created or modified is deleted, a later action that modifies it no longer has anything to modify and the change no longer works.
- Use
<b>and<i>tags when styling text elements with the rich-text editor: use<b>rather than<strong>for bold text, and<i>rather than<em>for italic text, because the<strong>and<em>tags might cause unexpected results. - Do not include
mboxCreateinside scripts, becausemboxCreateusesdocument.write. UsemboxDefineandmboxUpdatefor the same purpose. - Do not update an HTML snippet with Target if the snippet requires JavaScript code for its initialization. The VEC performs the Edit HTML action after JavaScript has instantiated the page component (such as sliders and carousels), but at delivery the action is applied before the component is instantiated, so delivery might appear broken. A delivery test that works the first time does not guarantee that delivery continues to work, because a race condition might exist, so test the page multiple times to make sure that delivery works as expected.
- When editing both a parent element and a child element, edit the parent first: the best workflow is to edit the parent element before swapping the image on the child element. If an image action is swapped on an element and the text or HTML of its parent element is then edited, delivery issues can occur.
Related pages:
- IP addresses to allowlist for the Enhanced Experience Composer proxy: The EEC will not load an internal QA URL that is not accessible on public IP (c-experiences/c-visual-experience-composer/r-troubleshoot-composer/troubleshooting-issues-related-to-the-enhanced-experience-composer-eec.md)
- Edit HTML used to manipulate the DOM structure, which can break selectors: Element Selectors Used in the Visual Experience Composer (c-experiences/c-visual-experience-composer/vec-selectors.md)
Personas:
- marketer: Can enable the Enhanced Experience Composer at the account level, with Administration > Visual Experience Composer, or at the individual activity level, while creating an activity in the Visual Experience Composer, with Configure > Page Delivery, by toggling the Enable Enhanced Experience Composer switch to the On position. The page states that the account level enables it for all activities created in the account. Where: “FAQ”.
- developer: Can conditionally disable security scripts, such as iframe-busting implementations, that might block pages from loading in the VEC under the Chrome V3 Manifest policies, when the page is loaded inside the Target iframe, by checking for the presence of
window.adobeVecExtension. Where: “Guardrails”.
Onboarding:
- Level: Intermediate, Experienced
- First minimal step: Enable the Enhanced Experience Composer at the account level with Administration > Visual Experience Composer, or at the activity level, while creating an activity in the Visual Experience Composer, with Configure > Page Delivery, then toggle the Enable Enhanced Experience Composer switch to the On position.