En esta página: Aprenda a instalar at.js 2.x y a llamar a triggerView() en las vistas de una aplicación de una sola página para que los especialistas en marketing puedan usarlas en el Adobe Target Compositor de experiencias visuales (VEC).
El VEC detecta solo las vistas definidas en el código de la SPA. Esta configuración de desarrollador único pone las vistas a disposición de los especialistas en marketing, que luego las utilizan para ejecutar pruebas A/B y XT en el VEC.
Instalación de at.js 2.x
at.js 2.x se ha desarrollado teniendo en cuenta las SPA. Las versiones anteriores de at.js no son compatibles con las vistas y el VEC para SPA.
Descargue at.js 2.x desde la interfaz Target, en Administración > Implementación.
at.js 2.x también se puede implementar mediante etiquetas en Adobe Experience Platform. Sin embargo, la extensión Adobe Target para etiquetas no está actualizada actualmente ni es compatible.
Llame a triggerView() en cada vista
Una vez definidas las vistas de la SPA que ejecutan una prueba A/B o XT, llame a la función triggerView() de at.js 2.x para cada vista, con el nombre de vista pasado como parámetro. Esta llamada permite a los especialistas en marketing diseñar y ejecutar pruebas para esas vistas en el VEC.
Cuando triggerView() no se llama para una vista, el VEC no detecta esa vista, por lo que los especialistas en marketing no pueden utilizarla en una prueba A/B o XT.
adobe.target.triggerView(viewName, options)
La función toma dos parámetros:
-
viewName(cadena, obligatorio): cualquier cadena que represente la vista. Este nombre se muestra en el panel Modificaciones del VEC, donde los especialistas en marketing crean acciones y ejecutan sus actividades A/B y XT. El nombre debe cumplir las siguientes reglas:- No tiene espacios finales y no está vacío.
- Es único para todas las páginas.
- No comienza ni finaliza con
/(consulte la advertencia siguiente). - La misma vista no se activa consecutivamente varias veces con la opción
{page: true}.
-
options(objeto, opcional): contiene la siguiente opción:page(booleano, opcional): controla si la llamada se cuenta como una impresión. En la tabla siguiente se enumeran los valores de.
/home" son nombres de vista diferentes.Valor page | Efecto |
|---|---|
| VERDADERO (predeterminado) | Las notificaciones se envían a los servidores de Edge para aumentar el recuento de impresiones. |
| FALSE | Las notificaciones no se envían para aumentar el recuento de impresiones. Utilice este valor para volver a procesar solo un componente de una página con una oferta. |
Los siguientes ejemplos llaman a triggerView() en React para el SPA de comercio electrónico hipotético.
Sitio de inicio
Para ejecutar pruebas A/B en todo el sitio principal, la vista puede llamarse “home”, que se extrae de la dirección URL.
Sitio del producto
Para personalizar la segunda fila del sitio del producto, por ejemplo, cambiando el color de la etiqueta de precio a rojo después de que un visitante haga clic en Cargar más, la vista se activa cuando se hace clic en ese botón.
cierre de compra
Para personalizar el contenido según las preferencias de envío seleccionadas, se crea una vista para cada preferencia: “Envío normal” cuando se selecciona Envío normal y “Envío exprés” cuando se selecciona Envío exprés.
Una vez implementadas las vistas, los especialistas en marketing pueden crear actividades para ellos. Para obtener más información, consulte Crear actividades en el VEC.
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)