Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Conditionally SDK Integration for Web #92

Closed
chandrabezzo opened this issue May 4, 2023 · 5 comments
Closed

Feature Request: Conditionally SDK Integration for Web #92

chandrabezzo opened this issue May 4, 2023 · 5 comments
Assignees

Comments

@chandrabezzo
Copy link

chandrabezzo commented May 4, 2023

Is your feature request related to a problem? Please describe.
Clear ways to install sdk for web. When we use several write key for environments case like staging, preview, and production. If we declare directly to index.html file we can't change value conditionally every build.

Describe the solution you'd like
How about to build js file from rudderstack SDK then call the file under index.html.

Describe alternatives you've considered
Another approach to send from dart side or command line to js side like flutter base href.

<!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.
    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.
    For more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
    This is a placeholder for base href that will be replaced by the value of
    the `--base-href` argument provided to `flutter build`.
  -->
  <base href="$FLUTTER_BASE_HREF">
@bardisg
Copy link
Contributor

bardisg commented May 4, 2023

Hello @chandrabezzo ,

For such cases like using different secrets per environment/build I would suggest flutter_dotenv and dedicated .env files per environment.

Is this an approach that could be of conveniance to you?

@1abhishekpandey
Copy link
Contributor

Hey @chandrabezzo, can you kidnly confirm if you are satisfied with our suggestion in the previous message?

@desusai7 desusai7 assigned desusai7 and unassigned itsdebs May 17, 2023
@desusai7
Copy link
Contributor

Hey @chandrabezzo,

I just realized that there is an issue with our documentation which directs you to get the JS SDK installation snippet from the JS SDK docs. There it includes the SDK initialization as well and it needs you to declare the write key and the data plane URL in index.html itself.

But we already had a way to pass the write key, and data plane URL from the dart side, you can just remove the load call in the JS SDK installation code snippet you are using in your index.html similar to our example here

@desusai7
Copy link
Contributor

@chandrabezzo, can you confirm updating the code snippet in the index.html helped solving your issue?

@chandrabezzo
Copy link
Author

Hi @desusai7 thanks for the confirm. So, for the latest version we doesn't need to add write key and data plane url via index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants