# Webflow

Paste the ProductLense script into the site-wide Head code in Webflow site settings, then publish to your domain.

In Webflow, site-wide custom code goes in Site settings → Custom code → Head code. It is added to every published page. Custom code requires a Webflow site plan that allows it, and it runs only on the published site, not in the Designer.

## Add the script

1. Copy your site id from Settings → Sites in the ProductLense dashboard.
2. In Webflow, open Site settings → Custom code.
3. Paste the snippet into Head code, replacing `SITE_ID`, and save.
4. Publish to your domain.

```html title="Site settings → Custom code → Head code" {2}
<script>window.productlense=window.productlense||function(){(window.productlense.q=window.productlense.q||[]).push(arguments)}</script>
<script defer data-site="SITE_ID" src="https://api.productlense.app/a.js"></script>
```

Add both your custom domain and the `webflow.io` staging domain to the site's hostnames in ProductLense if you want to see traffic from both; events from a hostname that is not listed are rejected.

## Custom events

Count form submissions as events from the page's custom code (Page settings → Before `</body>` tag):

```html title="Page settings → Before </body> tag" {4}
<script>
  document.addEventListener('submit', (e) => {
    if (e.target.matches('form')) {
      window.productlense('event', 'Signup', { form: e.target.getAttribute('data-name') || 'form' });
    }
  }, true);
</script>
```

Then add `Signup` as a goal in the dashboard. See [custom events](/docs/track/custom-events) and [goals and funnels](/docs/dashboard/goals-and-funnels).

If your product's signup happens in your own app after a Webflow marketing site, call `identify` there, not on Webflow; see [identify users](/docs/track/identify-users).

## Verify your installation

1. Publish, then open the published site in a normal browser window.
2. Open the Live page in the ProductLense dashboard. Your visit appears within a few seconds.
3. In the browser's developer tools, the Network tab shows a `POST` to `https://api.productlense.app/api/e` with status `204`.

The Designer preview does not run custom code. Ad blockers in your own browser may block the request. If the visit does not appear, follow [Verify your installation](/docs/install/verify).
