Implementare le visualizzazioni per il Compositore esperienza visivo per applicazioni a pagina singola implement-views
In questa pagina: Scopri come installare at.js 2.x e chiamare triggerView() sulle visualizzazioni di un’applicazione a pagina singola, in modo che gli addetti al marketing possano utilizzarle nel Adobe Target Compositore esperienza visivo (VEC).
Il Compositore esperienza visivo rileva solo le visualizzazioni definite nel codice dell’applicazione a pagina singola. Questa configurazione per sviluppatori una tantum rende le visualizzazioni disponibili per gli esperti di marketing, che le utilizzano per eseguire test A/B e XT nel Compositore esperienza visivo.
Installare at.js 2.x
at.js 2.x è stato sviluppato pensando alle applicazioni a pagina singola. Le versioni precedenti di at.js non supportano le visualizzazioni e il Compositore esperienza visivo per le applicazioni a pagina singola.
Scarica at.js 2.x dall’interfaccia Target, in Amministrazione > Implementazione.
at.js 2.x può essere distribuito anche tramite tag in Adobe Experience Platform. Tuttavia, l’estensione Adobe Target per i tag non è aggiornata o supportata.
Chiama triggerView() su ogni visualizzazione trigger-view
Una volta definite le visualizzazioni dell’applicazione a pagina singola che eseguono un test A/B o XT, chiama la funzione triggerView() di at.js 2.x per ogni visualizzazione, con il nome della visualizzazione passato come parametro. Questa chiamata consente agli addetti al marketing di progettare ed eseguire test per tali visualizzazioni nel Compositore esperienza visivo.
Quando triggerView() non viene chiamato per una visualizzazione, il Compositore esperienza visivo non la rileva, pertanto gli addetti al marketing non possono utilizzarla in un test A/B o XT.
adobe.target.triggerView(viewName, options)
La funzione accetta due parametri:
-
viewName(stringa, obbligatorio): qualsiasi stringa che rappresenta la visualizzazione. Questo nome viene visualizzato nel pannello Modifiche del Compositore esperienza visivo, in cui gli addetti al marketing creano azioni ed eseguono le attività A/B e XT. Il nome deve soddisfare le seguenti regole:- Non ha spazi finali e non è vuoto.
- È univoco per tutte le pagine.
- Non inizia o termina con
/(vedi l’avviso seguente). - La stessa visualizzazione non viene attivata consecutivamente più volte con l’opzione
{page: true}.
-
options(oggetto, facoltativo): contiene la seguente opzione:page(booleano, facoltativo): controlla se la chiamata conta come impression. Nella tabella seguente sono elencati i valori.
/home" sono nomi di visualizzazione diversi.pageGli esempi seguenti chiamano triggerView() in React per l’ipotetica applicazione a pagina singola per e-commerce.
Per eseguire test A/B sull’intero sito principale, la visualizzazione può essere denominata “home”, che viene estratta dall’URL.
| code language-javascript |
|---|
|
Per personalizzare la seconda riga del sito prodotti, ad esempio modificando il colore dell’etichetta del prezzo in rosso dopo che un visitatore ha fatto clic su Carica altro, la visualizzazione viene attivata quando si fa clic su tale pulsante.
| code language-javascript |
|---|
|
Per personalizzare il contenuto in base alla preferenza di consegna selezionata, viene creata una visualizzazione per ogni preferenza: “Consegna normale” quando è selezionata l’opzione Consegna normale e “Consegna express” quando è selezionata l’opzione Consegna express.
| code language-javascript |
|---|
|
Una volta implementate le Visualizzazioni, gli addetti al marketing possono creare attività per conto loro. Per ulteriori informazioni, consulta Creare attività nel Compositore esperienza visivo.
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)