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

feat: Add Growthbook App #3615

Merged
merged 15 commits into from
Dec 10, 2024
Merged

feat: Add Growthbook App #3615

merged 15 commits into from
Dec 10, 2024

Conversation

tzjames
Copy link
Contributor

@tzjames tzjames commented Nov 17, 2024

Purpose

Growthbook is the #1 open-source & warehouse native experimentation platform. This app lets Contentful customers create new experiments directly within Contentful and manage which content will be shown to the experiment's users.

Approach

The app consists of a library to connect to the Growthbook API. It is installed in three locations:

  1. The Configuration Page: Here the installer can add in the Growthbook API key, host and other needed information to connect to the Growthbook API. It also installs the Growthbook Experiment content type.
  2. The Entry Editor: Here content managers can give a title to their experiment and add reference entries to the variations list.
  3. The Sidebar: Here they can interact with the Growthbook API. Once the entry has a title and two variations the "Create Experiment" button becomes valid, and clicking it will create an experiment on Growthbook. If any changes get made to the experiment an "Update Experiment" button is shown which can apply any changes. Once everything is looking good they can click on a "Start Experiment" button which calls the Growthbook API to start the experiment.

Users of this app will have to install the Growthbook SDK on their site. The Growthbook SDK will figure out which variation index to show to which users. Showing the correct content to the users for the Growthbook Experiment content type is as simple as selecting that same index in the variations list and looking up the content it references.

Testing steps

An example app lays out the steps to integrate the Growthbook Contentful app to create a working site.
growthbook/examples#52

  1. Clone the growthbook examples repo.
  2. Checkout the ji/contentful branch.
  3. cd contentful
  4. Follow the instructions on the readme.

Run npm run tests

Breaking Changes

No it should not affect other apps.

Dependencies and/or References

The example app will be landed once this app is approved and on the marketplace.
The wiki page will also be published on Growthbook Docs.

Deployment

The app can be installed by running npm run dev and installing a custom app on Contentful pointing to localhost:3000.

@tzjames tzjames requested a review from a team as a code owner November 17, 2024 12:04
@tzjames tzjames changed the title Add Growthbook App feat: Add Growthbook App Nov 17, 2024
@david-shibley-contentful
Copy link
Contributor

There is a failing test. Looks like we need to add a mock API key to the test and/or null check in the obfuscateApiKey method.

@tzjames
Copy link
Contributor Author

tzjames commented Nov 19, 2024

There is a failing test. Looks like we need to add a mock API key to the test and/or null check in the obfuscateApiKey method.
Thanks for pointing that out, it happened only after adding new obfuscation code.

Copy link
Contributor

@mgoudy91 mgoudy91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission! This is looking pretty good, just have a few questions for you about the app:

  1. To run this locally, you are using dev? I tried using the start command, but it didn't appear to work in an expected way and couldn't find any specific instructions. The dev command did seem to work wrt sourcing the app locally on port 3000.
  2. Curious if you were able to get a hosted bundle built with your build command to work. https://www.contentful.com/developers/docs/extensibility/app-framework/app-bundle/ Eventually this app will need to work as a hosted bundle, and I've been having problems getting this working with this app, but I could also be missing a step in your workflow.

Thanks for the help!

@tzjames
Copy link
Contributor Author

tzjames commented Dec 4, 2024

Thanks for the submission! This is looking pretty good, just have a few questions for you about the app:

  1. To run this locally, you are using dev? I tried using the start command, but it didn't appear to work in an expected way and couldn't find any specific instructions. The dev command did seem to work wrt sourcing the app locally on port 3000.

Thanks for taking a look. Yes when I run npm run build it does successfully build to the directory /out. Running npm run start does work for me then. Did you run npm install?

  1. Curious if you were able to get a hosted bundle built with your build command to work. https://www.contentful.com/developers/docs/extensibility/app-framework/app-bundle/ Eventually this app will need to work as a hosted bundle, and I've been having problems getting this working with this app, but I could also be missing a step in your workflow.

I've been able to deploy it running npm run upload to https://app.contentful.com/account/organizations/6P3dU1el5fv4XYG0cThwq5/apps/definitions/7uAz1h1M4L5KgJszLnPG7f/general.

@tzjames tzjames requested a review from mgoudy91 December 4, 2024 14:43
@mgoudy91
Copy link
Contributor

mgoudy91 commented Dec 4, 2024

Perfect, thanks for the fixes and response. I took another look and identified the reason why we weren't able serve the statically hosted files. Let me know if that looks good to you and commit it if so.

After that we're ready to accept this PR and we'll get underway on the deployment process on our end

@mgoudy91 mgoudy91 force-pushed the ji/growthbook branch 2 times, most recently from bf679be to 7f06f35 Compare December 5, 2024 16:12
@sarahlessner
Copy link
Contributor

@tzjames thanks for making the requested change. We'll start the process of deploying the app today.

@mgoudy91 mgoudy91 added this pull request to the merge queue Dec 10, 2024
Merged via the queue into contentful:main with commit 4030a59 Dec 10, 2024
4 of 5 checks passed
@github-actions github-actions bot mentioned this pull request Dec 10, 2024
@tzjames
Copy link
Contributor Author

tzjames commented Dec 10, 2024

@tzjames thanks for making the requested change. We'll start the process of deploying the app today.

That's great news. Let me know when it's deployed and we will land our docs change and example app.

@mgoudy91
Copy link
Contributor

@tzjames it's out now, please let us know if you see any issues or problems with it working. It looked fine on our end, but we don't have a valid api key for growthbook so we can't really end-to-end test it.

Thanks again for the submission and your assistance with the process!

@tzjames
Copy link
Contributor Author

tzjames commented Dec 16, 2024

@mgoudy91 Looks good. It seems to be working.

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

Successfully merging this pull request may close these issues.

4 participants