Page view conversion metrics
Read time: 5 minutes
Last edited: Mar 18, 2024
Overview
This topic explains how to create a page view conversion metric in LaunchDarkly.
Page view conversion metrics are only compatible with the following SDKs:
- Electron
- JavaScript
- Node.js (client-side)
- React Web
- Vue
If you do not use one of these SDKs and would like to track clicks or page views, use a custom conversion/binary metric instead.
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 the browser redirected 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. To learn more, read Sending custom events and Flushing events.
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 SDKs.
For example, you might want to track how often customers view an item when its price is discounted different amounts.
Metric analysis
When you create a metric you must decide how you want to handle its metric analysis:
- Unit aggregation method: Select either "Sum individual unit values" or "Average individual unit values," depending on what the metric is measuring. For metrics you plan to use in funnel experiments, you must select "Average individual unit values." To learn more, read Unit aggregation method.
Creating page view conversion metrics
To create a page view conversion metric:
- Navigate to the Metrics list.
- Click Create metric. The "Create metric" panel appears.
- Enter a human-readable Name for the metric.
- (Optional) Enter a Description.
- (Optional) Type or choose from available Tags.
- (Optional) Choose a Maintainer. By default, the person who creates the metric is set as the Maintainer.
- In the "Event information" section select Page view:
- Specify the Target type you want to track behavior on. Expand the section below to view the four types of URL matching.
Expand URL matching options
URL matching schema | Description | Example |
---|---|---|
Simple match | This sends an event when the end user accesses a URL, or clicks on an element hosted at a URL, that matches the string you enter in the Target URL field or a formulation of that URL that included appended parameters. If you want events to record for URLs with substrings, specify each URL individually. | If you specify:
Then LaunchDarkly sends events from views or clicks at:
If you specify:
Then LaunchDarkly sends events from views or clicks at:
|
Exact match | This sends an event when the end user accesses a URL, or clicks on an element hosted at a URL, that exactly matches what you enter in the Target URL field. Identical base URLs with different substrings do not send events. | If you specify:
Then LaunchDarkly sends events from views or clicks at:
Views and clicks at |
Regular expression | This sends an event based on a regex expression you specify. This lets you designate more precise locations to send click and page view events. | If you specify:
Then LaunchDarkly sends events from views or clicks at any string between |
Substring match | This sends an event when the end user accesses a URL, or clicks on an element hosted at a URL with a specific string of text in it. | If you specify:
Then LaunchDarkly sends events from views or clicks at:
Because all of these URLs contain |
- Enter the Target URL.
- (Optional) Click Add target URL to track behavior on more than one URL.
- Choose one or more randomization units for the metric to measure events from.
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.
- Choose a Unit aggregation method. For metrics you plan to use in funnel experiments, you must select "Average individual unit values."
- Click Create metric.
After you create a metric, you can connect it to an experiment or use it to monitor the performance of flag changes. To learn how, read Creating experiments and Release guardian.
You can also use the REST API: Create metric