Skip to content

Adjust encoding of event payload to work in Google Analytics #23

@quadmachine

Description

@quadmachine

Several attributes included in our tracking payload, e.g. page title include spaces which need to be encoded before being sent to GA. Currently this is done by

const qs = new URLSearchParams(JSON.parse(JSON.stringify(payload))).toString()

which returns a string where spaces have been replaced with +. Unfortunately GA doesn't decode this before displaying in it's UI, but it does hovewer decode %20 properly.

Is there any way that you switch to using encodeURIComponent to encode the payload in a way which will be decodeable by GA, or alternativelly even enabling a way to provide custom serialization function?

I can create a PR which fixes the encoding issue if that would work for you?

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions