Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,17 @@ public static MessageBuildResult Build(
string formattedPropertyName = pair.Key;
ObjectProperty objectProperty = pair.Value;

ValueParseResult result = GenericPropertyParser.Parse(objectProperty.Value, allowCollections: true);
ValueParseResult result;

if (config.CustomPropertiesParser != null)
{
result = config.CustomPropertiesParser(objectProperty.Value, true);
}
else
{
result = GenericPropertyParser.Parse(objectProperty.Value, allowCollections: true);
}

if (!result.Success)
{
continue;
Expand Down
8 changes: 7 additions & 1 deletion src/Mixpanel/Mixpanel/MixpanelConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Mixpanel.Parsers;
using System;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -49,6 +50,11 @@ public class MixpanelConfig
/// </summary>
public static MixpanelConfig Global { get; }

/// <summary>
/// With this property you can create your own Parser to handle custom properties.
/// </summary>
public Func<object, bool, ValueParseResult> CustomPropertiesParser { get; set; }

static MixpanelConfig()
{
Global = new MixpanelConfig();
Expand Down
2 changes: 1 addition & 1 deletion src/Mixpanel/Mixpanel/Parsers/ValueParseResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Mixpanel.Parsers
{
internal sealed class ValueParseResult
public sealed class ValueParseResult
{
public bool Success { get; }
public object Value { get; }
Expand Down