• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    Page view conversion metrics

    Read time: 1 minute
    Last edited: Mar 01, 2023

    Overview

    This topic explains how to create a page view conversion metric for an experiment in LaunchDarkly.

    Some metrics require the JavaScript or React SDK

    Page view conversion metrics are only available on the JavaScript and React SDKs. If you do not use the JavaScript or React SDK and would like to track clicks or page views, use a custom conversion metric.

    Call track and flush when an end user is redirected

    SDKs send events at regular intervals, such as every five seconds. If a browser redirects an end user to another page, any events that occurred between when the SDK last sent events and when browser redirected the end user will be lost. To avoid this, call track and then flush when you know the browser will redirect an end user to another page, such as on click.

    Page view conversion metrics track how often end users view an element on a page hosted at a specific URL. Page view conversion metrics must be used with either the JavaScript or React SDK.

    For example, you might want to track how often customers view an item when its price is discounted different amounts.

    Creating page view conversion metrics

    To create a page view conversion metric:

    1. Follow steps 1-7 in Creating click conversion metrics until you have configured the form up to the "Event information" section.
    2. Click the Event kind menu and select "Page view":
    The "Event kind" menu.
    The "Event kind" menu.
    1. Specify the type of Target URL you want to track behavior on. To learn about the different options for URL matching, read the table in Creating click conversion metrics.
    2. (Optional) Click Add additional URL to track behavior on more than one URL.
    3. Choose one or more context kinds available for experiments for the metric to measure events from.
    Metrics must use valid randomization units

    Using invalid randomization units will result in invalid experiment results. To learn more, read Randomization units. If you're unsure of which randomization unit to use, contact Support for help determining valid context kind selections.

    1. Click Save metric.

    After you create a metric, you can connect it to an experiment. To learn how, read Building experiments.

    You can also use the REST API: Create metric