• User

    Implementazione contemporanea di DataLayer su UA e GA4

    Buongiorno a tutti,
    Volevo gentilmente chiedere, in caso di un'implementazione in parallelo di Universal Analytics e Google Analytics 4, se esiste una best practice per l'ordine e le modalità di caricamento dei rispettivi Data Layer di un evento? Ossia se è opportuno inserire un dataLayer.push per ognuno dei due eventi oppure un singolo evento specifico che contenga entrambi i Data Layer.
    Ringrazio in anticipo per la disponibilità.
    Buona giornata a tutti 🙂
    Simone


  • Contributor

    Un unico push con tutte le variabili necessarie.

    Stesso trigger.

    Due tag differenti, ciascuno con le sue configurazioni per i parametri:

    • UA con Categoria, Azione, Etichetta + eventuali Custom Dimensions
    • GA4 con parametri standard + eventuali custom

    S 1 Risposta
  • User

    @kal ciao Kal, grazie mille per la risposta.
    Il punto è che con una struttura di Data Layer "ibrida" Universal Analytics pare non leggere la transazione (correttamente visualizzata su GA4).
    Attualmente dopo l'evento di purchase viene rilevata questa struttura:

    {
      env: "development",
      site_section: "thankyou_page",
      site_area: "null",
      gtm_curCurrency: "EUR",
      gtm_http_status_code: "200",
      renderingTemplate: "",
      navigazione_in_app: "no",
      isInternalTraffic: "no",
      detected_device: "d",
      user_id: "null",
      user_status: "no_logged",
      crm_id: "null",
      cart_products: 0,
      wishlist_products: 0,
      ecommerce: {
        currencyCode: "EUR",
        purchase: {
          actionField: {
            id: "ITA00051676",
            affiliation: "",
            revenue: "259.50",
            tax: "46.79",
            shipping: "0.00",
            coupon: "",
            gtm_shippingMethod: "BRTITSTD_IT",
            promo: [
              {promo_name: "promo_name", promo_id: "promo_id"},
              {promo_name: "promo_name", promo_id: "promo_id"}
            ]
          },
          products: [
            {
              name: "product1_name",
              id: "product1_id",
              price: "354.00",
              brand: "brand_name",
              category: "clothing/dresses/short_dresses",
              variant: "\"Lichen” Green",
              quantity: 1,
              dimension14: "not_in_sale",
              dimension16: "42"
            },
            {
              name: "product2_name",
              id: "product2_id",
              price: "165.00",
              brand: "brand_name",
              category: "bags/handbags",
              variant: "Black",
              quantity: 1,
              dimension14: "not_in_sale",
              dimension16: "U"
            }
          ]
        },
        transaction_id: "ITA00051676",
        affiliation: "",
        value: "259.50",
        tax: "46.79",
        shipping: "0.00",
        currency: "EUR",
        coupon: "",
        promo_name: "promo_name|promo_name",
        promo_id: "promo_id|promo_id",
        items: [
          {
            item_id: "product1_id",
            item_name: "product1_name",
            affiliation: "",
            coupon: "",
            currency: "EUR",
            discount: "177.00",
            index: 0,
            item_brand: "brand_name",
            item_category: "clothing",
            item_category2: "dresses",
            item_category3: "short_dresses",
            item_variant: "\"Lichen” Green",
            price: "354.00",
            quantity: 1
          },
          {
            item_id: "product2_id",
            item_name: "product2_name",
            affiliation: "",
            coupon: "",
            currency: "EUR",
            discount: "82.50",
            index: 1,
            item_brand: "brand_name",
            item_category: "bags",
            item_category2: "handbags",
            item_category3: "",
            item_variant: "Black",
            price: "165.00",
            quantity: 1
          }
        ]
      },
      tipo_pagamento: "credit_card",
      circuito_cc: "visa",
      event: "purchase",
      gtm: {uniqueEventId: 1}
    }
    

    Riusciresti gentilmente a dirmi dove sto sbagliando?
    Ti ringrazio ancora per la disponibilità 🙂


    kal 1 Risposta
  • Contributor

    @simone-pestoni qui è un po' macchinosa la storia, perché molto probabilmente c'è qualche conflitto nell'oggetto ecommerce{} che è comune ad entrambe le piattaforme, ma ha due strutture dati diverse.

    Cosa potresti fare:

    1. crei un oggetto separato ecommerce {} ed ecommerce_ga4 {}
    2. Il primo ti serve perché viene letto automaticamente da GTM e sparato su UA, zero sbatta
    3. Il secondo tanto lo devi mappare a mano (sigh), basta che peschi gli array/oggetti corretti dal datalayer e le salvi come variabili nei campi parametro opportuni

    S 1 Risposta
  • User

    @kal grazie mille 🙂 quindi una struttura del genere dici che potrebbe andare bene?

    {
      env: "development",
      site_section: "thankyou_page",
      site_area: "null",
      gtm_curCurrency: "EUR",
      gtm_http_status_code: "200",
      renderingTemplate: "",
      navigazione_in_app: "no",
      isInternalTraffic: "no",
      detected_device: "d",
      user_id: "null",
      user_status: "no_logged",
      crm_id: "null",
      cart_products: 0,
      wishlist_products: 0,
      ecommerce: {
        currencyCode: "EUR",
        purchase: {
          actionField: {
            id: "ITA00051676",
            affiliation: "",
            revenue: "259.50",
            tax: "46.79",
            shipping: "0.00",
            coupon: "",
            gtm_shippingMethod: "BRTITSTD_IT",
            promo: [
              {promo_name: "promo_name", promo_id: "promo_id"},
              {promo_name: "promo_name", promo_id: "promo_id"}
            ]
          },
          products: [
            {
              name: "product1_name",
              id: "product1_id",
              price: "354.00",
              brand: "brand_name",
              category: "clothing/dresses/short_dresses",
              variant: "\"Lichen” Green",
              quantity: 1,
              dimension14: "not_in_sale",
              dimension16: "42"
            },
            {
              name: "product2_name",
              id: "product2_id",
              price: "165.00",
              brand: "brand_name",
              category: "bags/handbags",
              variant: "Black",
              quantity: 1,
              dimension14: "not_in_sale",
              dimension16: "U"
            }
          ]
         }
        },
        ecommerce_ga4: {
            transaction_id: "ITA00051676",
            affiliation: "",
            value: "259.50",
            tax: "46.79",
            shipping: "0.00",
            currency: "EUR",
            coupon: "",
            promo_name: "promo_name|promo_name",
            promo_id: "promo_id|promo_id",
            items: [
            {
                item_id: "product1_id",
                item_name: "product1_name",
                affiliation: "",
                coupon: "",
                currency: "EUR",
                discount: "177.00",
                index: 0,
                item_brand: "brand_name",
                item_category: "clothing",
                item_category2: "dresses",
                item_category3: "short_dresses",
                item_variant: "\"Lichen” Green",
                price: "354.00",
                quantity: 1
            },
            {
                item_id: "product2_id",
                item_name: "product2_name",
                affiliation: "",
                coupon: "",
                currency: "EUR",
                discount: "82.50",
                index: 1,
                item_brand: "brand_name",
                item_category: "bags",
                item_category2: "handbags",
                item_category3: "",
                item_variant: "Black",
                price: "165.00",
                quantity: 1
            }
            ]
      },
      tipo_pagamento: "credit_card",
      circuito_cc: "visa",
      event: "purchase",
      gtm: {uniqueEventId: 1}
    }
    

  • Contributor

    Yep.

    E per GA4 quando vai a creare le variabili:

    https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtm#purchase-gtm

    Invece che pescare:

    ecommerce.items
    

    Vai a pescare

    ecommerce_ga4.items
    

    E lo salvi nella variabile

    {{Ecommerce Items}}
    

    Dovrebbe funzionare.