Exemple #1
0
        // generic method for dumping all events
        internal void Dump(RudderEvent rudderEvent)
        {
            try
            {
                // create event json from rudder event object
                JsonWriter writer = new JsonWriter();
                writer.PrettyPrint = false;
                JsonMapper.ToJson(rudderEvent, writer);
                string eventString = writer.ToString();

                // check database connection
                if (dbConnection == null)
                {
                    CreateDatabaseConnection();
                }

                using (var cmd = dbConnection.CreateCommand())
                {
                    // dump event json to database
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "INSERT INTO events (event, updated) VALUES (@Event, @Updated);";
                    cmd.Parameters.Add(new SqliteParameter
                    {
                        ParameterName = "Event",
                        Value         = eventString
                    });
                    cmd.Parameters.Add(new SqliteParameter {
                        ParameterName = "Updated", Value = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds
                    });
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                Debug.Log("RudderSDK: Dump: Error" + ex.Message);
            }
        }
Exemple #2
0
 // end point for page events
 public void Page(RudderEvent rudderEvent)
 {
     rudderEvent.rl_message.rl_type = RudderEventType.PAGE.value;
     repository.Dump(rudderEvent);
 }
Exemple #3
0
 // end point for track events
 public void Track(RudderEvent rudderEvent)
 {
     rudderEvent.rl_message.rl_type = RudderEventType.TRACK.value;
     repository.Dump(rudderEvent);
 }