How to track links and forms in Framer

You might want to know how many times a specific link is clicked or how often a form is submitted. You can do this by adding a tracking ID to a link or form.

When adding a link, you can include a tracking ID during setup. Use a unique ID to ensure your results are accurate and not mixed with other events.

Add tracking to a form

When selecting a form on the canvas, you can add a tracking ID during setup. Whenever someone submits the form on your site, the event will be tracked.

Viewing results

Once you’ve added tracking to a link or form, you can view the results in your Analytics Overview. There will be a section called “Tracking”, where you can see the top 20 tracking events on your site. You can also use these tracking IDs in Funnels and A/B tests to measure conversion rates.

Record tracking events in an external system (Rudderstack, Segment, GA, etc.)

Framer provides custom events that you can use to track user interactions on your site. These events can be easily integrated with analytics platforms like Google Analytics or Segment.

Add the following script to the Custom Code section of your site:

// Listen for click events
document.addEventListener("framer:click", (event) => {
    console.log("Click tracked:", event.detail.trackingId);
});
// Listen for click events
document.addEventListener("framer:click", (event) => {
    console.log("Click tracked:", event.detail.trackingId);
});
// Listen for click events
document.addEventListener("framer:click", (event) => {
    console.log("Click tracked:", event.detail.trackingId);
});

Available events

Event

Description

Details

framer:click

When someone clicks a link with a tracking ID set

{
  trackingId: string;
  href: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  trackingId: string;
  href: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  trackingId: string;
  href: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}

framer:formsubmit

When someone submits a form with a tracking ID set

{
  trackingId: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  trackingId: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  trackingId: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}

framer:pageview

When someone views a page

{
  framerLocale: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  framerLocale: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  framerLocale: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}

framer:triggerinvoke

When a trigger with a tracking ID set is invoked

{
  trackingId: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  trackingId: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}
{
  trackingId: string;
  abTestId?: string;
  abTestingVariantId?: string;
  abTestingVariantName?: string;
  webPageId: string;
}

Track A/B test variants in an external system

Every Framer event includes details about the page and any A/B test the visitor sees. Use them to report which variant someone saw in tools like Mixpanel, Segment or Google Analytics.

Field

Description

abTestId

The ID of the A/B test running on the page. Undefined if the page has no A/B test.

abTestingVariantId

The ID of the variant the visitor sees. Undefined if the page has no A/B test.

abTestingVariantName

“control” for the original page, otherwise the name of the variant page. Undefined if the page has no A/B test.

webPageId

The ID of the original page. For A/B test variants, this is the page the variant belongs to.

Use the IDs to group results. They stay the same when you rename a variant. The variant name only changes on events sent after the rename.

document.addEventListener("framer:pageview", (event) => {
    mixpanel.track("Page viewed", {
        abTestId: event.detail.abTestId,
        variantId: event.detail.abTestingVariantId,
        variantName: event.detail.abTestingVariantName,
        pageId: event.detail.webPageId,
    });
});
document.addEventListener("framer:pageview", (event) => {
    mixpanel.track("Page viewed", {
        abTestId: event.detail.abTestId,
        variantId: event.detail.abTestingVariantId,
        variantName: event.detail.abTestingVariantName,
        pageId: event.detail.webPageId,
    });
});
document.addEventListener("framer:pageview", (event) => {
    mixpanel.track("Page viewed", {
        abTestId: event.detail.abTestId,
        variantId: event.detail.abTestingVariantId,
        variantName: event.detail.abTestingVariantName,
        pageId: event.detail.webPageId,
    });
});

Example: Google Analytics using gtag.js

document.addEventListener("framer:click", (event) => {
    gtag('event', 'click', {
        'event_category': 'engagement',
        'event_label': event.detail.trackingId,
        'value': event.detail.href
    });
});
document.addEventListener("framer:click", (event) => {
    gtag('event', 'click', {
        'event_category': 'engagement',
        'event_label': event.detail.trackingId,
        'value': event.detail.href
    });
});
document.addEventListener("framer:click", (event) => {
    gtag('event', 'click', {
        'event_category': 'engagement',
        'event_label': event.detail.trackingId,
        'value': event.detail.href
    });
});

Example: Universal Analytics using analytics.js

document.addEventListener("framer:click", (event) => {
    ga('send', 'event', {
        eventCategory: 'engagement',
        eventAction: 'click',
        eventLabel: event.detail.trackingId,
        eventValue: event.detail.href
    });
});
document.addEventListener("framer:click", (event) => {
    ga('send', 'event', {
        eventCategory: 'engagement',
        eventAction: 'click',
        eventLabel: event.detail.trackingId,
        eventValue: event.detail.href
    });
});
document.addEventListener("framer:click", (event) => {
    ga('send', 'event', {
        eventCategory: 'engagement',
        eventAction: 'click',
        eventLabel: event.detail.trackingId,
        eventValue: event.detail.href
    });
});

FAQ

How do I add tracking to a link or form in Framer?

When adding a link or selecting a form on the canvas, you can include a unique tracking ID during setup. This ensures your results are accurate and not mixed with other events. For links, add the tracking ID when setting up the link. For forms, add the tracking ID during the form setup. Whenever someone clicks the link or submits the form, the event will be tracked.

Where can I view the results of my tracking events in Framer?

Once you’ve added tracking to a link or form, you can view the results in your Analytics Overview. There is a section called 'Tracking' where you can see the top 20 tracking events on your site. You can also use these tracking IDs in Funnels and A/B tests to measure conversion rates.

Can I send Framer tracking events to external analytics platforms like Google Analytics or Segment?

Yes, Framer provides custom events that you can use to track user interactions and send them to analytics platforms like Google Analytics or Segment. You can add a script to the Custom Code section of your site to listen for events such as 'framer:click' or 'framer:formsubmit' and forward them to your analytics tool. Example scripts are provided for both gtag.js and analytics.js integrations.

Can I see which A/B test variant a visitor saw in my own analytics tool?

Yes. All Framer events (framer:pageview, framer:click, framer:formsubmit and framer:triggerinvoke) include abTestId, abTestingVariantId, abTestingVariantName and webPageId. Listen for these events in your site’s Custom Code and forward the fields to tools like Mixpanel, Segment or Google Analytics.

Updated

Your next idea starts here

GPT 6.1 Sol

Create personal portfolio

Build startup site

Launch landing page

Start company blog

Framer UI showing Pages, Layers and Assets panels titles