gabek / SegmentIO-Brightscript

A BrightScript interface to SegmentIO event tracking
5 stars 4 forks source link

Basic Example Troubles #3

Open dzoba opened 8 years ago

dzoba commented 8 years ago

I'm having difficulty with the basic example. I am trying to run an app with nothing happening, except an event being fired. This is my appMain.brs:

MessagePort = CreateObject("roMessagePort")
User = createObject("roDeviceInfo").GetDeviceUniqueId()
ApiKey = "myactualkey"

Analytics = Analytics(User, ApiKey, MessagePort)

'details = CreateObject("roAssociativeArray")
'details.myField = "My Field Data"
'Analytics.AddEvent("New Event", details)

'My event loop
while true
    msg = MessagePort

    'details = CreateObject("roAssociativeArray")
    'details.myField = "My Field Data"
    'Analytics.AddEvent("New Event", details)

    Analytics.HandleAnalyticsEvents(msg)
end while

I have tried this with either commented out chunk uncommented, and all I am seeing is:

------ Running dev 'test2' main ------                                                                                                                                                                                                        
Analytics Initialized...

Am I doing something wrong? I can't seem to actually get an event to send. Do you have an example of a most-basic app that does nothing other than send an event?

I am using a Roku 3.

Thanks!

gabek commented 8 years ago

Hey there! I'll check it out. I haven't used this library in a bit since I've moved away from Segment and instead just using Amplitude directly, so maybe something changed. I'll give it a test and see what happens. Thanks!

dzoba commented 8 years ago

Thank you so much!

dzoba commented 8 years ago

I tried messing with some of the internals of your library. I had to delete some things (GeoData and https://github.com/gabek/SegmentIO-Brightscript/blob/master/Analytics.brs#L164 ) because the Roku would just error on those lines.

I got all the way to https://github.com/gabek/SegmentIO-Brightscript/blob/master/Analytics.brs#L187 but could not determine how to see what happened, eg a response code or similar.

gabek commented 8 years ago

So the way you would find out what happened is by examining your event loop.

For example inside your

while true
  msg = portYouSpecified.GetMessage()

You can check out the message if it's a response from the transfer:

if type(msg) = "roUrlEvent" then
  print msg.GetResponseCode()
  print msg.GetFailureReason()
end if
gabek commented 8 years ago

And sorry about my delay looking into this, I plan on doing it this weekend!