0

Client side and server side tracking in a rails app?

There are two of us who set up segment - one on the client side and one on the server side. Our backend person actually set up the ruby on the client side on accident. And somehow it works???? I'm very confused how. This is what happened - she followed the ruby documentation but I had set up a client side source (website javascript) so she took the write key from the client source and put that in our rails app. We don't have any scripts (like analytics.js scripts) but we are somehow getting data to our mixpanel (although the data seems not very not accurate). 

 

So my question is - to fix this, we should set up a rails server side source, and add analytics.js for the client side to our app? How do I test that this is working in development before pushing everything to production?

1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Kelly,

     

    Thanks for getting in touch! If I'm understanding you correctly, your teammate set up a Ruby server and took the write key from a Javascript project in Segment so data from that Ruby server is following through a Segment Javascript source. That is completely plausible. The source options within Segment are just convenient wrappers to keep your projects organized. There isn't any operational code between them to actually differentiate where you're sending data from. The real piece of data that speaks to what library you're using is in the JSON payload of your events (See the attached screenshot).

     

    I took a look at your workspace and though your events are coming in through what appears to be a client-side Javascript source, if you check the payload you can see they're actually coming server-side from your Ruby server. I apologize for the confusion there! To keep things easy to understand, I would recommend using the write key for the Ruby server in the UI.

     

    In terms of the data that's coming into Mixpanel, could you elaborate on what you're getting there and what you expect to get? I'd be happy to help with that! It might be easier to create a ticket directly with our Success Engineering team using this form. We'll be able to work with you more quickly to resolve whatever issues you might be having there.

     

    Can you give me some more context around what you'd like to test? I'd be happy to help there as well! If you'd just like to test that you're getting Ruby data into the Ruby source you've set up in Segment, you can just switch to the Ruby write key and you'll immediately start seeing data populate in that source instead.

     

    Best,
    Spencer
    Success Engineer | Segment

    Reply Upvote