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

General wp #34

Closed JustinSainton closed 10 years ago

JustinSainton commented 10 years ago

Lots of goodies here. See commits for details, but very little left unturned here.

ianstormtaylor commented 10 years ago

This is sweet! Couple things I see:

Looks good!

JustinSainton commented 10 years ago

Cool, I'll pull out the created property, no problem, and change the userHash name.

Shortcode allows users to call custom events, anywhere, using the track or page APIs. For example, if you wanted to track a custom event, beyond the page being viewed, on a given post or page (or custom post type, you could use the following shortcode:

[segment method="track" event="Did a Special Thing" properties="Mood=happy,Sun=shining"]

That's a silly example, but a very real use case would be a store where I didn't want to track any products except for one. With the new "Exclude Custom Post Types" setting, I could have products not tracked by default, and have the following shortcode on a single product:

[segment method="track" event="Viewed Product" properties="ID=12,SKU=MYSKU,Name=Fancy Expensive Widget"]

It currently supports both page and track APIs (if method is excluded, it defaults the page API), and supports attributes for method, event, properties, options, category and name.

ianstormtaylor commented 10 years ago

For that store example, why would they want to disable tracking for all but one product like that? Is that something that's common to WP?

Just seeing if we can eliminate it to keep the plugin code paths simpler, so that we don't end up with some craaaazy stuff happening :)

JustinSainton commented 10 years ago

Because we have 70K+ shops running WP eCommerce, I've had the "pleasure" of seeing all sorts of crazy, sort of unfathomable edge cases. A scenario like that is one I could totally see if a shop sold one item that was the 'breadwinner', and then a bunch of useless crap they just don't care about :) Sort of edge case-ish, but again, we see weird stuff like that all the time.

All that said, it wouldn't break my heart to rip out the shortcode stuff. I just put it in there because it was an issue here. :dancer:

ianstormtaylor commented 10 years ago

Absolutely, that was my fault for not making it more clear as a "random idea i had in the middle of the night" haha. I think we should not include the shortcodes for now, get the 1.0.0 in front of people, and see where the big painpoints are. And then we might end up adding it back in if people ask

On Mon, Jul 14, 2014 at 1:58 PM, JustinSainton notifications@github.com wrote:

Because we have 70K+ shops running WP eCommerce, I've had the "pleasure" of seeing all sorts of crazy, sort of unfathomable edge cases. A scenario like that is one I could totally see if a shop sold one item that was the 'breadwinner', and then a bunch of useless crap they just don't care about :) Sort of edge case-ish, but again, we see weird stuff like that all the time.

All that said, it wouldn't break my heart to rip out the shortcode stuff. I just put it in there because it was an issue here. [image: :dancer:]

— Reply to this email directly or view it on GitHub https://github.com/segmentio/analytics-wordpress/pull/34#issuecomment-48958759 .

JustinSainton commented 10 years ago

Ha, no worries! Sounds good, easy enough to re-add for sure.

Another random use case that popped into my head, for when it does come back in: lots of plugins add shortcodes, for example, you might have a membership site that would show different content based on the membership level the user is at, and shortcodes would be used to show the different content. That would be another really good use case for tracking the membership levels via Segment.

Commit forthcoming! :D