Sur cette page : Découvrez comment installer at.js 2.x et appeler triggerView() sur les vues d’une application monopage, afin que les marketeurs puissent les utiliser dans le Adobe Target Compositeur d’expérience visuelle (VEC).
Le VEC détecte uniquement les vues définies dans le code de la SPA. Cette configuration de développeur ponctuelle met les vues à la disposition des spécialistes marketing, qui les utilisent ensuite pour exécuter des tests A/B et XT dans le compositeur d’expérience visuelle.
Installation d’at.js 2.x
at.js 2.x a été développé en tenant compte des SPA. Les versions antérieures d’at.js ne prennent pas en charge les vues et le VEC pour les SPA.
Téléchargez at.js 2.x à partir de l’interface Target dans Administration > Implémentation.
at.js 2.x peut également être déployé par le biais de balises dans Adobe Experience Platform. Toutefois, l’extension Adobe Target pour les balises n’est actuellement pas à jour ni prise en charge.
Appel de triggerView() sur chaque vue
Une fois les vues de la SPA qui exécutent un test A/B ou XT définies, appelez la fonction triggerView() d’at.js 2.x pour chaque vue, avec le nom de la vue transmis en tant que paramètre. Cet appel permet aux spécialistes marketing de concevoir et d’exécuter des tests pour ces vues dans le compositeur d’expérience visuelle.
Lorsque triggerView() n’est pas appelé pour une vue, le compositeur d’expérience visuelle ne détecte pas cette vue. Les marketeurs ne peuvent donc pas l’utiliser dans un test A/B ou XT.
adobe.target.triggerView(viewName, options)
La fonction utilise deux paramètres :
-
viewName(chaîne, obligatoire) : toute chaîne qui représente la vue. Ce nom s’affiche dans le panneau Modifications du compositeur d’expérience visuelle, où les marketeurs créent des actions et exécutent leurs activités A/B et XT. Le nom doit respecter les règles suivantes :- Il ne comporte pas d’espaces de fin et n’est pas vide.
- Il est unique pour toutes les pages.
- Elle ne commence ni ne se termine par
/(voir l’avertissement ci-dessous). - La même vue n’est pas déclenchée plusieurs fois de suite avec l’option
{page: true}.
-
options(objet, facultatif) : contient l’option suivante :page(booléen, facultatif) : contrôle si l’appel compte comme une impression. Le tableau suivant répertorie les valeurs.
/home » sont des noms de vue différents.Valeur page | Effet |
|---|---|
| TRUE (par défaut) | Des notifications sont envoyées aux serveurs Edge pour incrémenter le nombre d’impressions. |
| FALSE | Les notifications ne sont pas envoyées pour incrémenter le nombre d’impressions. Utilisez cette valeur pour effectuer le rendu uniquement d’un composant d’une page avec une offre. |
Les exemples suivants appellent triggerView() dans React pour l’hypothétique SPA d’e-commerce.
Site d’accueil
Pour exécuter des tests A/B sur l’ensemble du site d’accueil, la vue peut être nommée « accueil », qui est extraite de l’URL.
Site du produit
Pour personnaliser la deuxième ligne du site de produits, par exemple en changeant la couleur de l’étiquette de prix en rouge après qu’un visiteur clique sur Charger plus, la Vue est déclenchée lorsque l’utilisateur clique sur ce bouton.
Passage en caisse
Pour personnaliser le contenu en fonction des préférences de diffusion sélectionnées, une vue est créée pour chaque préférence : « Diffusion normale » lorsque Diffusion normale est sélectionnée et « Diffusion express » lorsque Diffusion express est sélectionnée.
Une fois les vues implémentées, les marketeurs peuvent créer des activités pour elles. Pour plus d’informations, voir Créer des activités dans le compositeur d’expérience visuelle.
AI Knowledge Reference
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: Install at.js 2.x and call
triggerView()on the Views of a single page application so that marketers can use them in the Adobe Target Visual Experience Composer (VEC).
Intents:
- Install at.js 2.x by downloading it from the Target interface, in Administration > Implementation.
- Call the
triggerView()function of at.js 2.x for each View, with the View name passed in as a parameter. - Name a View so that it meets the rules for the
viewNameparameter. - Control with the
pageoption whether the call counts as an impression. - Make the Views available to marketers, who then use them to run A/B and XT tests in the VEC.
Glossary:
- View (product-specific): a View of the single page application, defined in the code of the SPA. The VEC detects only the Views that are defined in the code of the SPA.
- at.js 2.x (product-specific): the version of at.js that was developed with SPAs in mind.
triggerView()(product-specific): the function of at.js 2.x called for each View, with the View name passed in as a parameter. The call allows marketers to design and run tests for those Views in the VEC. Its signature isadobe.target.triggerView(viewName, options).viewName(String, required): any string that represents the View. This name displays in the Modifications panel of the VEC, where marketers create actions and run their A/B and XT activities.options(Object, optional): contains thepageoption.page(Boolean, optional): controls whether the call counts as an impression. TRUE (default): notifications are sent to the Edge servers to increment the impression count. FALSE: notifications are not sent to increment the impression count; use this value to re-render only a component of a page with an offer.
Guardrails:
- Earlier versions of at.js do not support Views and the VEC for SPAs.
- When
triggerView()is not called for a View, the VEC does not detect that View, so marketers cannot use it in an A/B or XT test. - The
viewNamemust meet the following rules: it has no trailing spaces and is not empty; it is unique for all pages; it does not start or end with/; the same View is not triggered consecutively multiple times with the{page: true}option. - The View name is generally extracted from the URL path, and “home” and “/home” are different View names.
- The Adobe Target extension for tags is not currently up to date or supported.
Terminology:
- Canonical name: Visual Experience Composer — Acronym: VEC.
- Canonical name: single page application — Acronym: SPA.
FAQ:
- What does the VEC detect? The VEC detects only the Views that are defined in the code of the SPA.
- Which at.js version supports Views and the VEC for SPAs? at.js 2.x. Earlier versions of at.js do not support them.
- Where do I download at.js 2.x? From the Target interface, in Administration > Implementation.
- What happens when
triggerView()is not called for a View? The VEC does not detect that View, so marketers cannot use it in an A/B or XT test. - When is the impression count not incremented? When the
pageoption is FALSE, notifications are not sent to increment the impression count. - Who uses the Views after the setup? Marketers, who use them to run A/B and XT tests in the VEC.
Examples:
- Home site (React, hypothetical e-commerce SPA): to run A/B tests on the whole home site, the View can be named “home”, which is extracted from the URL.
- Product site (React, hypothetical e-commerce SPA): to personalize the second row of the product site, for example by changing the price label color to red after a visitor clicks Load more, the View is triggered when that button is clicked. The View name in the sample is ‘PRODUCTS-PAGE-’ followed by the page number.
- Checkout (React, hypothetical e-commerce SPA): to personalize content depending on the selected delivery preference, a View is created for each preference: “Normal Delivery” when Normal Delivery is selected, and “Express Delivery” when Express Delivery is selected.
Related pages:
- After the Views are implemented, to create activities for them as a marketer: Create activities in the VEC (c-experiences/spa-visual-experience-composer.md)
Personas:
- developer: Can download at.js 2.x from the Target interface, in Administration > Implementation, and call
adobe.target.triggerView(viewName, options)for each View of the single page application. Can passviewName(String, required) and the optionalpageoption (Boolean, default TRUE) to control whether the call increments the impression count. Can setpageto FALSE to re-render only a component of a page with an offer. The page states that earlier versions of at.js do not support Views, and that the VEC does not detect a View whentriggerView()is not called for it. Where: “Call triggerView() on each View”.
Onboarding:
- Level: Experienced
- First minimal step: Download at.js 2.x from the Target interface, in Administration > Implementation.
- Success check: After the Views are implemented, the View names display in the Modifications panel of the VEC, where marketers create actions and run their A/B and XT activities.
- Next: After the Views are implemented, to create activities for them as a marketer: Create activities in the VEC (c-experiences/spa-visual-experience-composer.md)