Skip to content

Disable localhost from being tracked #4

@flaborda

Description

@flaborda

Hi, thanks for sharing your work!

I was trying to disable GA from tracking localhost with no luck, here is my code

onMount(async () => {
	if ($page.host.split(':')[0] == 'localhost') { 
	console.log(window)
		window['ga-disable-G-XXXXXXXXX'] = true; // enter your tracking ID
		console.log('disabled GA for localhost!')
	}
});

let ga_measurment_id = "G-XXXXXXXXX"

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