segment-boneyard / analytics-magento

[DEPRECATED] The hassle-free way to integrate analytics into any Magento store.
15 stars 19 forks source link

skus and pricing in cart #27

Closed ianstormtaylor closed 10 years ago

ianstormtaylor commented 10 years ago

From a customer email:

  • It lacks some key properties we're currently tracking (e.g., SKUs in cart, item prices).

@astorm do you have context here? Which calls related to products are we not tracking sku and price on, and can we add that in?

astorm commented 10 years ago

Which call are we supposed to sending this information along? Can't you see that on your end? Or no?

ianstormtaylor commented 10 years ago

That was from Steven's feedback, but if it's already there feel free to close. I haven't seen an Add to Cart one stream through the Debugger yet personally

astorm commented 10 years ago

Ian, sorry, I'm not clear from your answer — which events in the Segment Ecommerce API are supposed to have "SKUs in cart" or the item price? If I don't know that, I can't know what to check here.

ianstormtaylor commented 10 years ago

Ah sorry, so basically every call that references a product, it would be nice to have the same properties that are product-related, so for example here's an example Viewed Product:

analytics.track('Viewed Product', {
  id: '507f1f77bcf86cd799439011',
  sku: '45790-32',
  name: 'Monopoly: 3rd Edition',
  price: 18.99,
  category: 'Games'
});

And then here's a Completed Order, where the items array has the same properties:

analytics.track('Completed Order', {
  id: '50314b8e9bcf000000000000',
  total: 30,
  revenue: 25,
  shipping: 3,
  tax: 2,
  products: [
    {
      id: '507f1f77bcf86cd799439011',
      sku: '45790-32',
      name: 'Monopoly: 3rd Edition',
      price: 19,
      quantity: 1,
      category: 'Games'
    },
    {
      id: '505bd76785ebb509fc183733',
      sku: '46493-32',
      name: 'Uno Card Game',
      price: 6,
      quantity: 4,
      category: 'Games'
    }
  ]
});

Ideally all product-related events would have the product ID, SKU, name and category. And then for the ones that make sense, price and quantity. If there are other properties that you know of that make sense those too.

But I was just saying it's hard for me to know if that is implemented or not based on the beta tester's email, since I only see events every once in a while in their debugger, so didn't want to assume that you hadn't set it up that way already. Does that make sense?

astorm commented 10 years ago

Got it, that makes sense. We should be sending that information over the the Completed Order action.

We didn't have a Viewed Product action — based on the docs I'd assumed the .page call was enough there. That is no longer the case with the latest code push

https://github.com/segmentio/analytics-magento/commit/be517ed22d49628e686114ea84a071a522bcf357

In addition to the fields mentioned above, I'm jamming through all Magento's product attributes.

screen shot 2014-07-16 at 2 59 28 pm

Magento doesn't, in a stock instal, have a concept of revenue. There is a cost attribute that's inconsistently used. For the Viewed Product page we add a revenue attribute in cost is present, and calculate revenue with a simple (price-cost) calculation.

If more calls than Viewed Product or Completed Order need this information just let me know.