Skip to content

Cannot read property 'track' of undefinedΒ #16

@peduarte

Description

@peduarte

Hello,

I've followed the instructions on the Readme.

  • Added plugin to gatsby-config
{
	resolve: 'gatsby-plugin-segment-js',
	options: {
		prodKey: 'KEY_HERE',
	},
}
  • Then, tracking an event:
window.analytics.track('test');

On development mode, I get Cannot read property 'track' of undefined.

Am I doing something wrong?

I know I can check if window.analytics exists, but the docs imply that this plugin was handling that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions