TryYourSize()
Esta página aún no está disponible en tu idioma.
Creates a client for your publishable key. Every element and call goes through it.
function TryYourSize(publishableKey: string, options: TryYourSizeOptions = {}): TryYourSizeClientParameters
Section titled “Parameters”publishableKeystringObligatorioYour publishable key (pk_test_… or pk_live_…) from Studio → Developers → API keys. It works only on the origins registered for it. A secret key (sk_…) throws secret_key_in_browser.
optionsTryYourSizeOptionsOpcional= {}Propiedades
embedOriginstringOpcionalOverride for development (e.g. http://localhost:5173).
apiOriginstringOpcionalOverride of the API origin for development (e.g. http://localhost:8000): the A/B holdout config.
localeLocaleOpcionalLanguage of our windows; "auto" follows the browser.
Returns
Section titled “Returns”TryYourSizeClient: The client: elements(), recommendation(), recommendationHandle(), experiment() and version.
Errors
Section titled “Errors”TryYourSizeError with code secret_key_in_browser or invalid_key. See Web SDK errors.
Example
Section titled “Example”import { TryYourSize } from "@tryyoursize/sdk";
const tys = TryYourSize("pk_test_…", { locale: "es" }); // windows in Spanish<script src="https://js.tryyoursize.com/v1/tys.js"></script><script> const tys = window.TryYourSize("pk_test_…");</script>import { TryYourSizeProvider } from "@tryyoursize/react";
// The provider calls TryYourSize() for you.<TryYourSizeProvider publishableKey="pk_test_…" options={{ locale: "es" }}> <App /></TryYourSizeProvider>See also
Section titled “See also”¿Te ha resultado útil esta página?
Gracias. Leemos todas las respuestas.