Skip to content

[Bug]: Using a custom tracking script name gives error #243

@joshdales

Description

@joshdales

Bug Description

I tried to update to a custom tracking script name, the script loads, but then does work beyond that.

Steps to Reproduce

  1. Set a custom tracking script name
  2. Deploy Counterscale
  3. Update counterscale-script src
  4. Errors in the console

Expected Behavior

Counterscale works as it does normally without a custom script name

Actual Behavior

I was getting a CORS error:

Access to XMLHttpRequest at 'https://counterscale.joshdales.dev/counter.js?sid=joshdales.dev' from origin 'https://joshdales.dev' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

However that was kinda a red herring, I think that the issue is here: https://github.com/benvinegar/counterscale/blob/main/packages/tracker/src/tracker.ts#L36 where tracker.js is hardcoded to be replaced rather than using the custom script name.

Component

@counterscale/tracker

Environment

  • OS: Mac
  • Browser: Chrome
  • Counterscale version: 3.4.1

Additional Context

Solved the issue for now by removing the custom script name

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions