All threads / Analytics with Segment Discussion

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Analytics with Segment Discussion

Dicussion for Analytics with Segment

Great episode Chris! Would be awesome to see some more detailed episodes both for client and server side implementations.

Got any specifics you'd like to see?

Would be great to see more details on how/why to choose client/server/mixed solutions and keep them in sync (I guess for some of the actions only FE can be used, but for others BE would be safer). How to build a bit more robust analytics tracking system with a bunch of analytics events without polluting/slowing down your code. (For instance creating a wrapper class for all analytics events, when to use BG jobs or when to use promises on FE, etc.). So basically a system design for a more complex segment implementation. I think this is also a great opportunity to show how to structure 3rd party code (as there can be many events in different places) and still writing clean ruby code.

Yeah, for some things for example you may want to track form submissions. Frontend code generally would just track the form submitting, but not whether or not it was successful. This can be useful and you may want to know attempted submissions vs successful submissions as an example.

You're not going to be slowing down your code in either case. Frontend runs in the user's browser so it won't slow anything down. Server-side events are submitted in asynchronously so they won't affect the speed of your code there either.

As for complex integrations, generally analytics are just designed to be an additional line of code that runs in your logic. You will already have methods or classes for that logic so you'd just drop in an additional line to says "Purchase complete" after running through your payments code.

I'll try to come up with an example to go a bit more in-depth on. Generally analytics aren't anything too complex, you've just gotta make sure you write good names for events so they make sense when you're analyzing them later. :)

Reply
Stephen Dolan ·

Lots of places in the video where I think you meant to edit in a cut, but instead left all of the re-takes in. It didn't make a difference to me, but you might want to be more thorough with editing (especially on the pro videos).

Reply
Rob Sobers ·

For anyone that wants to see a very detailed implementation of Segment within a real world Rails SaaS app, I wrote extensively about that here: https://robsobers.com/9-dol...

Funny, this is the very reason I'm implementing Segment right now. Rob's article is pretty awesome in terms of the things you can do with such a cheap / free marketing stack.

Reply

For anyone who isn't seeing events load in the debugger:

Make sure you have any adblockers switched off for localhost:3000 or any other website with this that you're testing!

Reply

Hi Chris,
Is it better to use track in html like <"script">analytics.track<"/script"> or in segment.js in asset pipeline?
If I have my identify in JS, is it possible to use user data for the server side? Is it the new cloud method (instead device)?
Thanks

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 38,311+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.