segment-boneyard / analytics-wordpress

[DEPRECATED] The hassle-free way to integrate analytics into any WordPress site.
https://segment.com/docs/platforms/wordpress/
GNU General Public License v2.0
41 stars 34 forks source link

custom fields in identify? #40

Open ianstormtaylor opened 10 years ago

ianstormtaylor commented 10 years ago

From a support ticket:

If there's a way to get the phone field in Pardot from the Checkout form, would it be possible then too to also retrieve the name and email? Or do they work differently? Sorry, when it comes to handling form data I am an extreme novice. Thank you for all your help.

Is there a way for us to get custom data like phone numbers of a user, or similar, into the identify call we are making? Right now I think we are just tracking WordPress default things like firstName and lastName?

cc @JustinSainton

JustinSainton commented 10 years ago

Absolutely. Are we talking about customer information in the checkout process here, or user profile info?

ianstormtaylor commented 10 years ago

I guess it would be interesting to see how both could be handled. I'm less familiar with how the checkout process would work though

JustinSainton commented 10 years ago

I think, pending third-party plugins being used, it would have to be the Checkout, as WordPress does not gather the phone number as part of the user profile creation.

jrjacobs commented 10 years ago

Hey there, thank you for creating this ticket. I'm the original inquirer as to this issue. My ultimate goal was to be able to gather the user fields from a checkout form (like with WooCommerce), and then send them to Pardot as integrated with my account. I saw a info in the documentations for segment to gather WP info like fname and lname, but I wasn't sure if that would require them having an account first, which we don't want. We have set up an event registration page and would like to be able to track buyer info and send it to Pardot. Here's the page with the WooCommerce checkout form: http://advantageauthoritymarketing.com/. Thank you so much for your help. You all have been awesome so far. Please let me know if I need to clarify anything further or provide more detail. Thanks!

JustinSainton commented 10 years ago

Hi @jrjacobs,

Gotcha, that makes sense. It would definitely be possible to hook into the woocommerce_thankyou hook, grab the address via WC_Order( $order_id )->get_shipping_address() and then use the values to filter the identify() call via segment_get_current_user_identify.

If that all makes sense, it should be enough to run with. Otherwise, I'll chat with @ianstormtaylor about rolling this into the core platform.

jrjacobs commented 10 years ago

Hey Justin, thank you for this response. I am somewhat familiar with programming with Woocommerce since we have a plugin that runs off of it, so I'll take a stab at it using your suggested method. It seems like it would make sense and would be able to work, so I'll see what I can do. Still, any possibility of it being built into the core Segment platform would be wonderful. I'll keep you posted as to whether I can get something going on my end. Thanks!