segment-boneyard / analytics-magento

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

Cleaning Up Traits #61

Closed ianstormtaylor closed 10 years ago

ianstormtaylor commented 10 years ago

Hey @astorm have an issue from a customer where they don't want some of the traits we're currently recording because they are clogging up some of their reporting. They were asking for the ability to choose which ones to send and not, however I think it might be a case where we can just safely assume that a decent amount can be not sent anymore, and then we can just whittle them down for all of the cases.

It looks like we currently record:

entity_id
entity_type_id
attribute_set_id
website_id
email
group_id
increment_id
store_id
created_at
updated_at
is_active
disable_auto_group_change
created_in
is_segment_aliased
full_name
name
tax_class_id
shared_store_ids
shared_website_ids
first_name
last_name
middle_name
total_orders
total_spent

Just going based on what I think will be useful to our users in their analytics and CRM tools, I propose that we remove the following traits:

entity_id
entity_type_id
attribute_set_id
website_id
group_id
increment_id
store_id
disable_auto_group_change
created_in
is_segment_aliased
full_name

And then that we change the following to pure booleans:

is_active

So that we end up with traits that look like this:

{
  created_at: Tue Sep 09 2014 16:19:54 GMT-0700 (PDT),
  email: 'name@example.com',
  first_name: 'John',
  last_name: 'Smith'
  middle_name: 'Charles',
  name: 'John Charles Smith'
  is_active: true,
  updated_at: Tue Sep 09 2014 11:19:56 GMT-0700 (PDT),
  total_orders: 7,
  total_spent: 42.83
}

How does that sound? I'm not sure how it's implemented, but if you think there will be specific attributes of a user that people add to their installations, maybe we should implement this as a blacklist instead of a whitelist?

ianstormtaylor commented 10 years ago

Edited, realized I forgot to include total_orders and total_spent in the traits we definitely want to keep!

astorm commented 10 years ago

I've added a new configuration section named customer traits with a default set of keys

screen shot 2014-09-14 at 3 04 05 pm

This configuration section controls which fields we'll send through. This should give you flexibility to add/remove fields if you want to in the future.

The defaults are set in config.xml

    <default>
        <segment_analytics>
            <options>
                <customer_traits>
created_at
email
first_name'
last_name
middle_name
name
is_active
updated_at
total_orders
total_spent             
                </customer_traits>
            </options>
        </segment_analytics>
    </default>

And if you want to remove the ability to have system administrators add/remove from this field just remove the customer_traits node in system.xml

                    <customer_traits>
                        <label>Customer Traits</label>
                        <comment>Which Magento Customer Data Fields to Send</comment>
                        <frontend_type>textarea</frontend_type>
                        <sort_order>20</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>                             
                    </customer_traits>