Once the Optimizely and Heap SDKs have been installed, you can use the following code snippet to track experiment data…