Giter Site home page Giter Site logo

Comments (9)

travisjeffery avatar travisjeffery commented on July 23, 2024

Hey, thanks for making this issue.

What version of the lib are you using? I'm pretty sure I fixed this issue in 2.0.2: aebd744. Can you upgrade to the latest version and let me know if that works for you?

from analytics-ruby.

hadees avatar hadees commented on July 23, 2024

So I upgrade to 2.0.3 and it fixed most of the issues however I've noticed some of my unresolved problems are because group doesn't behave just like identify. I fixed part of that in the pull request above but it seems like there might be a server side fix that needs to happen because Intercom still reports any date I pass it as happening in 1970.

from analytics-ruby.

travisjeffery avatar travisjeffery commented on July 23, 2024

ok just pushed that pr in 2.0.4.

can you make a comment with code you've got that reproduces the issue? i'm looking at server now and created_at should definitely be working, other dates you're passing into traits may not.

from analytics-ruby.

hadees avatar hadees commented on July 23, 2024

Okay I think there still are some issues but I'm trying to standardize my tests a bit. The test date/time I'm going to use is Mon, 16 Jun 2014 15:48:33 CDT -05:00 and I've converted it to ActiveSupport::TimeWithZone, DateTime, Time, and Date.

test_data = User.first.created_at  # => Mon, 16 Jun 2014 15:48:33 CDT -05:00
traits = { 
  time_with_zone: test_data,  # => Mon, 16 Jun 2014 15:48:33 CDT -05:00
  datetime: test_data.to_datetime, # => Mon, 16 Jun 2014 15:48:33 -0500
  time: test_data.to_time, # => 2014-06-16 15:48:33 -0500
  date: User.first.created_at.to_date # => Mon, 16 Jun 2014
}

After I've got the data I setup the segment client

client = Segment::Analytics.new({
  write_key: ENV['SEGMENT_IO_WRITE_KEY'],
  on_error: Proc.new { |status, msg| print msg }
})

Then I finally identify with Segment

client.identify({
  user_id: 1,
  context: {},
  traits: traits
})

and here is the raw output of the identify

{
  "userId": "1",
  "anonymousId": null,
  "integrations": {},
  "traits": {
    "time_with_zone": "2014-06-16T15:48:33-05:00",
    "datetime": "2014-06-16",
    "time": "2014-06-16T15:48:33-05:00",
    "date": "2014-06-16"
  },
  "timestamp": "2014-06-17T21:11:24.000Z",
  "type": "identify",
  "messageId": "e4ea5aa4-cf2a-439a-9158-e0d090013505",
  "writeKey": "bu5sbmslht",
  "receivedAt": "2014-06-17T21:11:23.431Z",
  "requestId": "p578qofv",
  "options": {
    "library": {
      "name": "analytics-ruby",
      "version": "2.0.4"
    }
  }
}

and then I called group with Segment.

client.group({
  user_id: 1,
  group_id: 1,
  context: {},
  traits: traits
})

and here is the raw output of the group

{
  "groupId": "1",
  "userId": "1",
  "traits": {
    "time_with_zone": "2014-06-16T15:48:33-05:00",
    "datetime": "2014-06-16",
    "time": "2014-06-16T15:48:33-05:00",
    "date": "2014-06-16"
  },
  "integrations": {},
  "timestamp": "2014-06-17T21:40:18.000Z",
  "type": "group",
  "messageId": "9eaa9056-93be-42b7-b6cb-94ef3ad1c0ee",
  "writeKey": "bu5sbmslht",
  "receivedAt": "2014-06-17T21:40:18.334Z",
  "requestId": "jfaakm0a",
  "options": {
    "library": {
      "name": "analytics-ruby",
      "version": "2.0.4"
    }
  }
}

This results in the following as of roughly today, 4:18 PM on June 17, 2014 (CDT).

Intercom User:

Intercom User Scree

Intercom Company:

Intercom Company

after explicitly setting the fields as dates

screen shot 2014-06-17 at 5 02 35 pm

Mixpanel:

screen shot 2014-06-17 at 5 09 23 pm

Class Intercom User Intercom Company Mixpanel
ActiveSupport::TimeWithZone 2014-06-16T20:48:33Z 2014-06-16T20:48:33Z 2014-06-16T15:48:33
DateTime 2014-06-16T00:00:00Z 2014-06-16T00:00:00Z 2014-06-15T19:00:00
Time 2014-06-16T20:48:33Z 2014-06-16T20:48:33Z 2014-06-16T15:48:33
Date 2014-06-16T00:00:00Z 2014-06-16T00:00:00Z 2014-06-15T19:00:00

note: I'm getting the Intercom values from inspecting the source and grabbing the datetime attribute from the time tag

So from my testing here is what I currently see problems with.

  • DateTime conversion is broken. It shouldn't be getting converted to a date because it strips off the time.
  • When you call group date fields on the Company in Intercom aren't getting the _at appended to them. I'm honestly not sure I really want _at being appended in Identify because the field name might not make sense like start_date_at and it's going to create all new fields for the date fields I already have at aren't named that way. However I'd at least like it to be consistent between the two methods so I know what to expect.

from analytics-ruby.

hadees avatar hadees commented on July 23, 2024

@travisjeffery are you going to open this issue again? I'm still have some problems.

from analytics-ruby.

travisjeffery avatar travisjeffery commented on July 23, 2024

so what you want is for the sdk to iso-fy each date in traits?

from analytics-ruby.

hadees avatar hadees commented on July 23, 2024

@travisjeffery I fixed the last issue with the gem.

The other issue is that you are now adding _at to date fields in Intercom. While this gets lets Intercom automatically detect the date correctly it breaks all my old date fields plus the names don't make any senses. I'd much rather just manually change the type in Intercom and not break my existing date fields. Also this behavior isn't even consistent because group traits don't get _at appended to them.

from analytics-ruby.

travisjeffery avatar travisjeffery commented on July 23, 2024

I just released v2.0.5 with #61. So as far as I know, all the date fixes I can make in the SDK have been made.

The _at issue is happening server-side and we're discussing the solution now. @calvinfo @ianstormtaylor

from analytics-ruby.

hadees avatar hadees commented on July 23, 2024

Thanks! I'll check out the changes tomorrow.

from analytics-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.