Skip to content

edgio-docs/edgio-v7-optimizely-edge-example

Repository files navigation

Edge-side Experiments with Optimizely

This example demonstrates how you may use edge functions to run Optimizely experiments.

Preview: https://edgio-community-examples-v7-optimizely-edge-live.glb.edgio.link/

The request workflow is as follows:

  • The client makes a request to / which is handled by an edge function.
  • The edge function fetches the Optimizely experiment variant and decides which text direction to use based on the variant.
  • The edge function makes another fetch request to the Wikipedia homepage and gets the HTML content.
  • The edge function modifies the HTML content to include the experiment variant.
  • The edge function sets the experiment variant cookie and returns the page to the client.
  • Depending on the experiment variant, the page may render normal or mirrored based on the applied transformation.

Getting Started

  1. Clone the repository:
git clone [email protected]:edgio-docs/edgio-v7-optimizely-edge-example.git
  1. Install the dependencies:
npm install
  1. Create a .env file in the root of the project and add the following environment variables:
OPTIMIZELY_SDK_KEY=...
  1. Start the development server:
npm run edgio:dev
  1. Open http://localhost:3000/ with your browser to see the result. Note: The page may render normally or mirrored based on the experiment variant.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published