Skip to main content

Website Events: Send Identified Visitors to Your Ad Pixels and Tag Manager

Tell your own website when Knock2 identifies a visitor's company, with their job function, seniority and ICP score, so your ad pixels and Google Tag Manager can act on it. Plus a tour of every tab under Settings > Script.

Written by Sara

Website events let your own website know, while the visitor is still on the page, when Knock2 has identified which company they're from. Your ad pixels and tag manager can then act on it: count a conversion for visits from your ideal customers, build audiences, or personalize the page.


Why use website events

Ad platforms like LinkedIn, Meta and Google Ads get better at finding the right people when you tell them which clicks led somewhere valuable. B2B form fills rarely happen often enough for that to work. Visits from companies that fit your ideal customer profile happen far more often, so they make a much stronger signal.

With website events switched on, every time Knock2 identifies a visitor's company, your site gets a message with the company, the visitor's likely role and how well the company fits your ICP. You decide what to do with it, for example firing a LinkedIn conversion only for good-fit companies.

Many teams send the same conversion from their server as well (for example through Meta's Conversions API). Sending it from the browser too gives the ad platform more to match on. Each event includes an ID you can use so the platform counts it only once. See Doing more with the Knock2 API at the end of this article for the server side.


How to turn it on

  1. Make sure the Knock2 script is installed on every page you want events from. See How to Install the Knock2 Script on Your Website.

  2. In Knock2, go to Settings > Script and open the Website events tab.

  3. Switch on Send website events.

  4. Choose How often and set Good fit above score (both explained below).

Only workspace admins can change these settings. Other teammates can see them but not edit them.

Changes take effect as visitors load new pages, usually within a few minutes. While website events are off, nothing changes on your site.


What the settings mean

Send website events

The on/off switch. Off by default.

How often

  • Every page view (recommended). An event is sent on each page the visitor views, including page changes on single-page apps. Each event says whether it's the first one in the visit, so you can still count once per visit in your own setup.

  • Once per visit. A single event per visit, sent once the company is identified. Choose this if you'd rather not write a "first in visit" rule in your tag manager.

Good fit above score

Each event includes the company's ICP score (0 to 100, from your lead scoring setup in Knock2) and a simple yes/no for whether the company is a good fit. This setting decides where that line is: a company counts as a good fit when its score is above this number. Leave it blank to use the default of 50, the same line as the Hot Leads view in your dashboard.

The score itself is always included, so you can also ignore the yes/no and apply your own rule.


What's in each event

  • Company: name, website domain, industry, employee range, country and LinkedIn company page.

  • Persona: the visitor's likely job function (for example Engineering, Sales, Marketing, Operations) and seniority (for example Executive, Director, Manager), plus both combined into one label like "Information Technology Manager". This is the same "Latest persona" you see on an account in Knock2. It's empty when Knock2 only knows the company.

  • ICP fit: the company's score, whether it's a good fit, and your fit line.

  • Existing customer: whether the company is on your existing customers list in Knock2, so you can leave current customers out of acquisition metrics.

  • Visit details: a visit ID (the same on every page of one visit), whether this is the first event in the visit, and the page it's for.

Website events never include who the visitor is: no name, email address, phone number or LinkedIn profile.


Using the events on your site

The Knock2 script sends each event three ways, so you can use whichever fits your setup. Most marketing teams use Google Tag Manager; developers often prefer the browser event.

Google Tag Manager

Every event is pushed to the data layer with the event name knock2_visitor_identified. To fire a conversion tag for good-fit visits:

  1. Create Data Layer Variables for knock2.icp.is_fit, knock2.first_in_session and knock2.is_existing_customer (and knock2.persona.job_function if you want to filter by role).

  2. Create a Custom Event trigger for knock2_visitor_identified that fires when knock2.icp.is_fit equals true. Add knock2.first_in_session equals true to count once per visit.

  3. Attach the trigger to your LinkedIn Insight Tag, Meta Pixel or Google Ads conversion tag.

Browser event (for developers)

Listen for knock2:visitor_identified. This example sends a LinkedIn conversion once per visit for good-fit companies that aren't already customers:

<script>
window.addEventListener("knock2:visitor_identified", function (e) {
  var visit = e.detail;
  if (visit.first_in_session && visit.icp.is_fit && !visit.is_existing_customer) {
    window.lintrk && window.lintrk("track", { conversion_id: 1234567 });
  }
});
</script>

If you also send the conversion from your server, use the visit ID as the event ID in both places so the ad platform counts it once. For the Meta Pixel, for example, pass { eventID: "knock2-" + visit.session_id } as the last argument to fbq, and the same value as the event ID on your server-side event.

Callback

Once the Knock2 script has loaded, you can also register a function with window.knock2.onVisitorIdentified(function (visit) { ... }). It's called on every event, and right away if an event has already been sent on the page. If your code might run before the Knock2 script loads, use the browser event or Google Tag Manager instead.


When events are sent

Knock2 identifies and scores the company just after the visitor's first page loads. Each page waits up to about 30 seconds for the score. If it hasn't arrived by then, the event is sent without a score, and the next page in the visit tries again.

No event is sent:

  • when Knock2 can't identify the visitor's company

  • for visitors who have opted out, including browsers sending a Global Privacy Control signal

  • on pages listed under Excluded pages


Privacy

Any script running on your website can read these events. That's why they're off until an admin switches them on, and why they never include who the visitor is. Job function and seniority describe a role, not a person. If your site runs scripts you don't control, keep that in mind before switching website events on.


Everything under Settings > Script

Website events sit alongside the other settings for the Knock2 script:

  • Script install. Your personal script snippet and installation instructions. See How to Install the Knock2 Script on Your Website.

  • Domain allow list. The websites the script is allowed to run on. An entry like example.com covers that domain and all of its subdomains.

  • Excluded pages. Pages where Knock2 won't run at all, such as careers pages, privacy policies or your logged-in app, plus UTM parameters to ignore. Website events are never sent on excluded pages. See How Knock2 Tracks Single-Page Apps for how exclusions work on single-page apps.

  • Website events. The settings described in this article.

  • Advanced. Serving the script from your own domain. This tab only appears for admins when the feature has been switched on for your workspace.


Doing more with the Knock2 API

Website events work in the visitor's browser, in the moment. Many teams pair them with a server-side setup using the Knock2 API, webhooks and the identification data Knock2 already stores. These work whether or not website events are switched on.

  • Pull identified visitors on a schedule. With an API key from Settings > API, list accounts and contacts and read their lead scores, then apply your own fit rules and send them wherever you need: your data warehouse, Segment, a reporting tool or an ad platform. A common pattern is an hourly job that picks up the last hour's visitors. See Using the Knock2 REST API.

  • Get pushed new identifications as they happen. Subscribe a webhook to account.identified, contact.identified or score.changed instead of polling. See Webhooks Overview.

  • Send conversions to ad platforms from your server. When a visitor arrives from an ad, Knock2 keeps the click ID (Google, Meta, LinkedIn, Microsoft and TikTok) on the identified account and contact. You can read it through the API or webhooks and upload it to the platform's offline conversion or Conversions API, using the visit ID as the event ID if you also send the browser event. See Ad Click IDs.

  • Match Knock2 data to your own records. Call window.knock2.setExternalId("your-id") on your site with your own visitor or session ID, and Knock2 hands it back on every contact it identifies from that browser, so you can join our data to yours without matching on names or emails.

  • Ask questions in plain English. Connect Knock2 to an AI assistant to build reports, like how many target accounts visited this month. See Connecting Knock2 to AI Tools (MCP).


Related


Need help? Contact us at support@knock2.ai or via the chat widget in your dashboard.

Did this answer your question?