Skip to content

Using Amplitude with SSR (React) #110

@adrienharnay

Description

@adrienharnay

Hi,

I am trying to migrate a codebase from client-side to server-side, and am using Amplitude like so:

import amplitude from 'amplitude-js/amplitude';

It is bundled by Webpack. On the server-side, I have this error:

document is not defined, l.3020, called by global scope block l.3007

I'm a bit lost on this, as there is browser-specific code in global scope and therefore it can't run on server...

Any insights?

Thanks in advance

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