This module exposes the default JSON encoder for analytics telemetry
encodeAction : String -> ( ( String, Json.Encode.Value ), ( String, Json.Encode.Value ) )
encodeAction takes a string and encodes it to JSON of the following format
-- for example the user gives a custom type DefInit as input
encodeAction <| Debug.toString DefInit
-- { "type": "DefInit", "payload":"null" }
NOTE : only custom types can be encoded, others will result in an error JSON -- for example if I try to encode Int 5 encodeAction <| Debug.toString 5 -- it will result in -- { "type": "ActionTypeError", "payload": "Please change Msg type to Custom Data type in Elm app" }
encodeModel : String -> Json.Encode.Value
encodeModel uses Analytics.Parser's encodeFlat function
NOTE : If an error is encountered during parsing following JSON is returned
-- { "type": "ModelParseError", "value": "ModelParseError"