traceo icon indicating copy to clipboard operation
traceo copied to clipboard

Install Browser/JS SDK

Open CarlosPinedaT opened this issue 1 year ago • 4 comments

More than reporting a BUG or similar, this issue is a very direct question.

How do I install the SDK for a project in Angular or similar, I can start reporting to the server.

I can't finish the issue without first congratulating you for the work you have done and I hope to contribute my grain of code to the project.

I hope to have an answer, thank you

CarlosPinedaT avatar Oct 19 '23 15:10 CarlosPinedaT

Hi @CarlosPinedaT, thank you for this issue.

For now there is a possibility to use sdk for browser, but only for React and Vue. Support for Angular should be added in the future, but it highly depend on my personal amount of free time. Therefore, any support is welcome :)

piotr-szewczyk avatar Oct 19 '23 17:10 piotr-szewczyk

Hello, thanks for the answer, Any way to integrate it with native Javascript currently?

CarlosPinedaT avatar Oct 19 '23 17:10 CarlosPinedaT

Hello, thanks for the answer, Any way to integrate it with native Javascript currently?

For browser - no, for NodeJS in backend side you can use this package.

piotr-szewczyk avatar Oct 19 '23 17:10 piotr-szewczyk

@CarlosPinedaT

import { BrowserClient, VERSION, ClientOptions } from "@traceo-sdk/browser";
class Client extends BrowserClient {
  constructor(apiKey: string, options: ClientOptions) {
    super({
      headers: {
        "x-sdk-name": "react",
        "x-sdk-version": VERSION,
        "x-sdk-key": apiKey,
      },
      options: {
        ...options,
        apiKey,
      },
    });
  }

  public postInitSDK(): void {}
}

new Client("apiKey", { performance: false, host: "host" });

LiHaoGit avatar Nov 09 '23 02:11 LiHaoGit