Creare il codice del contenuto code-content

In questa pagina: scopri come scrivere o incollare HTML non elaborati nell’editor di codice di E-mail Designer per creare contenuti e-mail, incluso come aggiungere la personalizzazione e le funzioni di data e ora disponibili.

Crea il tuo codice ti consente di scrivere o incollare HTML non elaborato per creare contenuti e-mail direttamente nel Designer e-mail di Journey Optimizer. Utilizzare questa modalità quando è necessario il controllo completo del markup o quando si importa HTML esistente.

È necessario disporre delle competenze HTML e una volta scelta questa modalità, rimane nell’editor di codice, non è possibile passare all’editor visivo.

➡️ Guarda un video su questa funzione

NOTE
Crea il tuo codice non è lo stesso dell'editor avanzato di HTML in E-mail Designer. L’editor HTML avanzato consente di passare dalla visualizzazione HTML a quella visiva (desktop) in qualsiasi momento, non dall’editor di codice. Ulteriori informazioni sull'editor avanzato di HTML.

Utilizzare l’editor di codice use-code-editor

Per creare o modificare il contenuto delle e-mail tramite l’editor di codice, segui la procedura riportata di seguito.

  1. Dalla home page di E-mail Designer, seleziona Crea un codice personale.

  2. Immetti o incolla il codice HTML non elaborato.

    note
    NOTE
    A differenza di quando progetti il messaggio e-mail da zero, l'editor di codice non offre un campo Preheader. Per definire una preintestazione, aggiungi il testo della preintestazione direttamente nel codice HTML. Ulteriori informazioni sui metadati delle e-mail
  3. Utilizza il riquadro a sinistra per sfruttare le funzionalità di personalizzazione di Journey Optimizer. Ulteriori informazioni

    note
    NOTE
    L’editor di personalizzazione in E-mail Designer presenta alcune limitazioni funzionali rispetto alle espressioni di percorso. Ulteriori informazioni sulle limitazioni della funzione data/ora
  4. Se desideri cancellare il contenuto e-mail e avviare l’e-mail da un nuovo design, Cambia il design nel menu delle opzioni.

    note
    NOTE
    Questa azione apre il modello selezionato in E-mail Designer. Da lì puoi completare il design dell’e-mail o tornare all’editor di codice utilizzando l’opzione Passa all’editor di codice.
  5. Fai clic sul pulsante Anteprima per controllare la progettazione e la personalizzazione del messaggio utilizzando i profili di test. Ulteriori informazioni

  6. Quando il codice è pronto, fai clic su Salva quindi torna alla schermata di creazione del messaggio per finalizzarlo.

CAUTION
Impossibile fare riferimento alle immagini di Adobe Experience Manager Assets quando si utilizza il metodo Code your own. Archivia le immagini a cui si fa riferimento nel codice HTML in una posizione pubblica.

Limitazioni della funzione data e ora date-time-limitations

Quando si utilizza la personalizzazione nell’editor di codice di E-mail Designer, la funzione now() non è disponibile per il calcolo dinamico delle date.

IMPORTANT
La funzione now() è non supportata nel linguaggio di espressione di Email Builder. now() è disponibile in condizioni di percorso, ma non può essere utilizzato all'interno del contenuto e-mail o nell'editor di codice.

Alternative disponibili:

Utilizza le seguenti funzioni per lavorare con la data e l’ora correnti nella personalizzazione delle e-mail:

  • getCurrentZonedDateTime() - Restituisce la data e l’ora correnti con le informazioni sul fuso orario. Questa è l’alternativa consigliata a now().

    Esempio: {%= getCurrentZonedDateTime() %} restituisce 2024-12-06T17:22:02.281067+05:30[Asia/Kolkata]

  • currentTimeInMillis() - Restituisce il tempo corrente in millisecondi epoca.

    Esempio: {%= currentTimeInMillis() %}

Soluzioni consigliate:

Se devi eseguire calcoli di date nel contenuto dell’e-mail:

  • Precalcola i campi data - Calcola i valori data obbligatori nella pipeline dei dati o negli attributi del profilo prima di inviare l’e-mail, quindi fai riferimento a tali valori precalcolati nella personalizzazione.

    Esempio: {%= profile.timeSeriesEvents._mobile.hotelBookingDetails.bookingDate %}

  • Utilizza le funzioni di manipolazione data. Utilizza funzioni data/ora come dayOfYear() o diffInDays() con valori data dagli attributi del profilo.

    Esempio: {%= formatDate(profile.timeSeriesEvents._mobile.hotelBookingDetails.bookingDate, "MM/dd/YY") %}

  • Usa attributi calcolati - Crea attributi calcolati che eseguono calcoli di data complessi, rendendo i risultati disponibili come attributi di profilo.

Per l’elenco completo delle funzioni supportate, vedere Funzioni data e ora.

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: Code your own lets you write or paste raw HTML to build email content directly in the Journey Optimizer Email Designer, add personalization, and work with the date and time functions available in email personalization.

Intents:

  • Build email content by entering or pasting raw HTML code after selecting Code your own from the Email Designer home page.
  • Use Code your own when you need full control over markup or when importing existing HTML.
  • Define a preheader by adding the preheader text directly in your HTML code.
  • Use the left pane of the code editor to leverage Journey Optimizer personalization capabilities.
  • Clear your email content and start your email from a new design by selecting Change your design from the options menu.
  • Check the message design and personalization using test profiles with Preview, then select Save and go back to the message creation screen to finalize your message.

Glossary:

  • Code your own (product-specific): The Email Designer mode that lets you write or paste raw HTML to build email content directly in the Journey Optimizer Email Designer.
  • Code editor (product-specific): The editor in which you enter or paste your raw HTML code when using Code your own; its left pane gives access to Journey Optimizer personalization capabilities.
  • Switch to code editor (product-specific): The option that lets you go back to the code editor from the Email Designer after selecting Change your design.
  • getCurrentZonedDateTime(): A function that returns the current date and time with time zone information.
  • currentTimeInMillis(): A function that returns the current time in epoch milliseconds.

Guardrails:

  • Once you choose Code your own, you stay in the code editor: you cannot switch to the visual editor.
  • Unlike when you design your email from scratch, the code editor does not offer a Preheader field.
  • Images from Adobe Experience Manager Assets cannot be referenced when using the Code your own method; store images referenced in your HTML code in a public location.
  • The personalization editor in the Email Designer has some function limitations compared to journey expressions.
  • The now() function is not supported in the Email Builder’s expression language: it cannot be used within email content or the code editor, while it is available in journey conditions.

Prerequisites and permissions:

  • You must have HTML skills to use Code your own.

Terminology:

  • Canonical name: Adobe Journey Optimizer — Acronym: AJO — variants: Journey Optimizer
  • Canonical name: Adobe Experience Manager — Acronym: AEM
  • Do not confuse: “Code your own” ≠ “advanced HTML editor”. The advanced HTML editor in the Email Designer lets you toggle between HTML view and the visual (Desktop) view at any time; with Code your own you stay in the code editor.

FAQ:

  • Can I switch from Code your own to the visual editor? No. Once you choose this mode, you stay in the code editor and cannot switch to the visual editor.
  • How do I define a preheader when coding my own email content? The code editor does not offer a Preheader field, so add the preheader text directly in your HTML code.
  • Can I use the now() function in email content? No. The now() function is not supported in the Email Builder’s expression language and cannot be used within email content or the code editor.
  • What can I use instead of now() in email personalization? Use getCurrentZonedDateTime(), which is the recommended alternative to now(), or currentTimeInMillis().
  • Can I reference images from Adobe Experience Manager Assets in my HTML code? No. Store images referenced in your HTML code in a public location.
  • How do I clear my email content and start from a new design? Select Change your design from the options menu. This action opens the selected template in the Email Designer, where you can complete the design of your email or go back to the code editor using the Switch to code editor option.

Examples:

  • getCurrentZonedDateTime() example: {%= getCurrentZonedDateTime() %} returns 2024-12-06T17:22:02.281067+05:30[Asia/Kolkata].
  • currentTimeInMillis() example: {%= currentTimeInMillis() %}.
  • Reference to a pre-calculated date field in email personalization: {%= profile.timeSeriesEvents._mobile.hotelBookingDetails.bookingDate %}.
  • Date manipulation with a date value from profile attributes in email personalization: {%= formatDate(profile.timeSeriesEvents._mobile.hotelBookingDetails.bookingDate, "MM/dd/YY") %}.

Best practices:

  • getCurrentZonedDateTime() is the recommended alternative to now() for working with the current date and time in email personalization.
  • Recommended workaround for date calculations in email content: pre-calculate date fields by calculating the required date values in your data pipeline or profile attributes before sending the email, then reference these pre-calculated values in your personalization.
  • Recommended workaround for date calculations in email content: use date/time functions like dayOfYear() or diffInDays() with date values from profile attributes.
  • Recommended workaround for date calculations in email content: create computed attributes that perform complex date calculations, making the results available as profile attributes.

Related pages:

Personas:

  • marketer: Can select Code your own from the Email Designer home page and enter or paste raw HTML code. Can use the left pane to leverage Journey Optimizer personalization capabilities. Can select Change your design from the options menu to clear the email content and start from a new design. Can select Preview to check the message design and personalization using test profiles. Can select Save, then go back to the message creation screen to finalize the message. The page states that once you choose this mode, you stay in the code editor and cannot switch to the visual editor. Where: “Use the code editor”.

Onboarding:

  • Level: Intermediate, Experienced
  • First minimal step: From the Email Designer home page, select Code your own.
recommendation-more-help
journey-optimizer-help