Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variant data missing on Purchase event for Woocommerce variable subscriptions #264

Open
Jasperste opened this issue Apr 17, 2023 · 0 comments

Comments

@Jasperste
Copy link

Jasperste commented Apr 17, 2023

Hello there,

We are using GA4 for Ecommerce tracking for our Woocommerce site with Woocommerce subscriptions using GTM4WP. We seem to have configured everything properly, when testing the view with Tag Manager we for example see the following for addToCart:

  event: "add_to_cart",
  ...
  productType: "variable-subscription",
  productIsVariable: 0,
  ecomm_prodid: "508",
  ecomm_pagetype: "product",
  ecomm_totalvalue: 64.99,
  ecommerce: {
    currencyCode: "EUR",
    detail: {
      products: [
        {
          id: 508,
          name: "Running on track",
          sku: "running-01",
          category: "training",
          price: 64.99,
          stocklevel: "",
          brand: "trainingcoach",
          variant: "bronze"
        }
      ]
    },
    currency: "EUR",
    value: 64.99,
    items: [
      {
        item_id: 508,
        item_name: "Running on track",
        item_brand: "trainingcoach",
        price: 64.99,
        item_category: "training",
        google_business_vertical: "retail",
        id: "508",
        item_variant: "bronze",
        quantity: "1"
      }
    ],
    add: {
      products: [
        {
          name: "Name",
          id: 508,
          price: 64.99,
          category: "training",
          stocklevel: "",
          brand: "trainingcoach",
          variant: "bronze",
          quantity: "1"
        }
      ]
    }
  },

This is for a variable subscription with variants. As you can see it registers the variant correctly, so we are able to differentiate that this is a variant of product X. However when we do the actual purchase the data is different (I used a 100% off coupon):

  event: "purchase",
  ...
  ecommerce: {
    currencyCode: "EUR",
    purchase: {
      actionField: {
        id: "x_y_z",
        affiliation: "",
        revenue: 0,
        tax: 0,
        shipping: 0,
        coupon: "mydiscount1"
      },
      products: [
        {
          id: 508,
          name: "Running on track",
          sku: "running-01",
          category: "",
          price: 0,
          stocklevel: null,
          brand: "",
          quantity: 1
        }
      ]
    },
    currency: "EUR",
    items: [
      {
        item_id: 508,
        item_name: "Running on track",
        item_brand: "",
        price: "",
        item_category: "",
        quantity: 1,
        google_business_vertical: "retail",
        id: "508"
      }
    ],
    transaction_id: "x_y_z",
    affiliation: "",
    value: 0,
    tax: 0,
    shipping: 0,
    coupon: "mydiscount1"
  },
  ecomm_prodid: [508],
  ecomm_pagetype: "purchase",

It now misses out on the variant data (variant: "bronze". Is this expected, a misconfiguration on our side or is this a bug? It seems like the latter where the purchase doesn't get registered correctly and holding the variant data. Also some other data seems to be missing like category being an empty string.

Happy to approve a PR or create a PR with the right pointers, if this can be solved within this repo.

Expected
The Purchase event to hold data about the variant, similar to the addToCart event.

Actual
The Purchase event doesn't mention anything about the variant, in this case it's being the bronze variant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant