Typeform Embed
The Typeform Embed integration dynamically injects Typeform forms into any page that includes the required data attributes that also includes the webinar viewer component. It enables collecting user input during or after a webinar session, and relays key events (like form completion) back to the parent application for analytics.
Props
Route Params
Component Attributes
data-cc-component - Typeforms FormId. (string, required) It is used as a unique identifier for the embedded Typeform instance.data-cc-component-embed-id - The Typeform embedId. (string, required) This attribute is used to load the embed.
Custom Behavior
- Dynamic Embedding: The script loaded via the webinar viewer component scans the DOM for elements with data-cc-component-embed-id and injects a Typeform form into each.
- Hidden Fields:
- webinar_id, lead_id, is_replay, user_id and page_url are passed as hidden fields to all Typeform elements for context and analytics.
- Event Handling: Listens for Typeform events (form-question-changed, form-submit) and relays them to the parent app via window.cc.sendMessage.
form-question-changed - fire an event to analytics letting them know a question has been answeredform-submit - hide the form
- Form ID can be found by going to the share tab and viewing the link at the top. The form id is the last section of that url before the hidden fields.
- https://form.typeform.com/to/cxVurA1R => formId = cxVurA1R
- Embed ID can be found by going to the share tab and clicking "Embed in a web page" to the left. Once there you can click the code icon (</>) to get the embed code. The value assigned to
data-tf-live is the embed id.
<div data-tf-live="01K0CE42YWSYW052FK4GZRX7PJ"></div>
<script src="//embed.typeform.com/next/embed.js"></script> - In this example embedId = 01K0CE42YWSYW052FK4GZRX7PJ
- Typeform Setup
Styling notes
This component is styled by the parent element.