Lune Docs Logo
Log inContact us

Analytics

With Lune, you can easily share reports with your customers, enabling them to explore their emissions.

Pre-requisites

Complete the following setup steps before using this guide:
/illustrations/stamp-key.png
Generate an API key and authenticate your account.
/illustrations/stamp-accounts.png
Set up Client Accounts to track emissions for your individual customers. Ensure external_pages_visibility is set to public or private.
  • Ensure that the is_transaction property is set to true when calculating emissions either through the API or CSV.Set transaction_processed_at to the date that the transaction was completed on. If not set, this property will default to the day the calculation was made.
  • 1. Configure your customer URL

    Each customer’s report is accessible via a unique URL:https://sustainability.lune.co/business/<YOUR_ORG_ID>/<CUSTOMER_HANDLE>Where:
    • <YOUR_ORG_ID> is your organisation’s ID, which remains constant. You can find this on the settings page of the Lune dashboard.
    • <CUSTOMER_HANDLE> is the unique identifier set during client account creation, as the handle property.
    Tip: Embed this URL directly into your application to simplify access for customers.
    For test client accounts, add test to the URL like so:https://sustainability.lune.co/business/test/<ORG_ID>/<HANDLE>

    2. Understanding the analytics page

    The analytics page provides comprehensive insights into your customers' emissions data. At a glance, customers can see the total tCO₂e calculated for their transactions, displayed prominently at the top of the page.
    Visualise emissions data
    Interactive graphs help customers explore their emissions in detail, with options to download each graph as a CSV or image. Key graphs include:
    • Total emissions calculated: Displays a breakdown by purchase category.
    • Emissions over time: Shows the total emissions per month over
    A sample graph showing a breakdown of emissions by shipping method.
    Individual calculations
    Beneath the total emissions graph, customers can access detailed data for each shipment. For each calculation, customers can find:
    • A step-by-step explanation of the calculation process.
    • A breakdown of the emission factor used, including its source.
    • Details of the input properties used to generate the estimate.
    An image showing a breakdown of each factor included in an individual emission calculation, as shown on the dashboard.
    FAQ section
    At the bottom of the page, a helpful FAQ answers common questions about logistics emissions calculations, empowering customers with the knowledge they need.

    3. Access controls

    Visibility options
    • public: Analytics pages are accessible to anyone with the URL
    • private: Analytics pages require authentication using a JWT and return 404 for unauthorized access
    • hidden: Analytics pages require authentication and return 404 for unauthorized access (default behaviour)
    Setting up privacy controls
    1. Configure external pages visibility
    Set the external_pages_visibility property when creating or updating a client account:
  • Creating a client account with hidden visibility
  • 2. Update existing accounts
    For existing client accounts, update the visibility setting via the accounts API:
  • Updating visibility for existing account
  • Access patterns
    Public visibility
    When external_pages_visibility is set to public:
    • Anyone with the URL can access the analytics page
    • No authentication required
    • Maintains existing behaviour for backward compatibility
  • Example URL
  • Private visibility
    When external_pages_visibility is set to private:
    • Client-signed JWT token required for access
    • Returns 404 for unauthorized requests
    • Protects against URL enumeration attacks
  • Example URL
  • Hidden visibility
    When external_pages_visibility is set to hidden:
    • The URL is not accessible
    • Returns 404
    JWT authentication
    Generating JWT tokens
    The JWT token payload does not require any properties: you can use an empty object. The secret key used for signing 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.It is recommended to generate a new token with an expiry every time you redirect your users.See below for an example of generating the JWT token using Typescript/Javascript:
  • JWT token generator
  • What to do next…

    Troubleshooting

    Having issues generating the URL? Verify your organisation ID and customer account handle for accuracy. Ensure the external_pages_visibility setting is configured to public.Missing shipment data? Confirm that the is_transaction parameter is set to true for all transactions. To update this property for previously calculated transactions, use the annotation update endpoint endpoint.Individual calculations should appear instantly, but graphs may have a lag.For further assistance, contact our support team.