Logistics emissions explanations widget
The Emissions Explanations widget provides a detailed breakdown of how an emission estimate is calculated, providing you and your customers transparency around contributing factors and ensuring you are audit-ready.Pre-requisites
Complete the following setup steps before using this guide:Generate an API key and authenticate your account.
Set up Client Accounts to track emissions for your individual customers.
Calculate and save emission estimate IDs for shipments.
1. Embed the Lune snippet
Add the following snippet to your front-end application in an appropriate location:
2. Generate a JWT token
To use the widget, you must authenticate using a JSON Web Token (JWT). This token verifies your identity and associates the emission estimate with the appropriate client account.The JWT token payload should include the account ID, which can be either your own account ID or that of the client for whom the booking flow is being displayed. The secret key for the token must be your API key, which can be generated in the Lune dashboard. The token should be generated in your backend-application as the API Key is a secret.See below for an example of generating the JWT token using Typescript/Javascript:
3. Add your HTML
To display emission estimate explanations in your front-end application, navigate to the sections where you want the explanations to appear. For each relevant section, add a<div class="lune-explanations-sidepanel">
element.This element contains two attributes:data-sessionToken
: for the JWT token generated prior.data-id
: The unique estimate ID for which the explanations will be displayed.
data-backgroundColor
data-textColor