{"id":26157,"date":"2024-06-17T14:58:17","date_gmt":"2024-06-17T14:58:17","guid":{"rendered":"https:\/\/refiner.io\/docs\/?post_type=knowledgebase&#038;p=26157"},"modified":"2025-09-08T13:34:47","modified_gmt":"2025-09-08T13:34:47","slug":"generate-embed-code","status":"publish","type":"knowledgebase","link":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/","title":{"rendered":"Generate Embed Code"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\">Locate the embed code<\/h2>\n\n\n\n<p>When creating an Embed Survey, you\u2019ll see an \u201cEmbed Code\u201d tab in the survey editor. This is where you can grab a Javascript code snippet that you need to include in the page where you want to render the survey.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"701\" src=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-1024x701.png\" alt=\"\" class=\"wp-image-26159\" srcset=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-1024x701.png 1024w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-800x547.png 800w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-768x525.png 768w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-1536x1051.png 1536w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-2048x1401.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Structure of the embed code<\/h2>\n\n\n\n<p>The provided embed code call the <em>embed<\/em> method of our <a href=\"https:\/\/refiner.io\/docs\/kb\/javascript-client\/client-introduction\/\">Javascript SDK<\/a>, the survey ID and the target HTML container in which you want to the survey to be rendered in. The syntax looks like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">_refiner('embed', '&lt;SURVEY-ID>', '&lt;HTML-ELEMENT-ID>');<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Use an alias for the survey<\/h2>\n\n\n\n<p>You&#8217;ll find an option to provide an alias for your survey. If you don&#8217;t provide an alias, the embed code will load the survey using a unique ID. Providing an alias for your surveys can be helpful when you want to exchange the survey with another survey without updating the code you are using. If you want to change your survey later on, all you need to do is to create a new survey using the same alias and deactivate your current survey.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Provide the target container<\/h2>\n\n\n\n<p>Embed Surveys are rendered inside an HTML container element that you can freely choose. The only condition is that the element exists in your HTML page and has a unique ID. <\/p>\n\n\n\n<p>When calling the <em>embed<\/em> method, our Javascript SDK locates the HTML container based on the ID you provide and attempts to render it inside the container. The container height will be adjusted automatically based on the survey content. The width of the container will not be altered.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Locate the embed code When creating an Embed Survey, you\u2019ll see an \u201cEmbed Code\u201d tab in the survey editor. This is where you can grab a Javascript code snippet that you need to include in the page where you want to render the survey. Structure of the embed code The provided embed code call the [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","template":"","knowledgebase_tag":[],"class_list":["post-26157","knowledgebase","type-knowledgebase","status-publish","hentry","knowledgebase_cat-embed-surveys"],"acf":[],"featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":"","ab-block-post-grid-landscape":"","ab-block-post-grid-square":"","gb-block-post-grid-landscape":"","gb-block-post-grid-square":""},"post_excerpt_stackable_v2":"<p>Locate the embed code When creating an Embed Survey, you\u2019ll see an \u201cEmbed Code\u201d tab in the survey editor. This is where you can grab a Javascript code snippet that you need to include in the page where you want to render the survey. Structure of the embed code The provided embed code call the embed method of our Javascript SDK, the survey ID and the target HTML container in which you want to the survey to be rendered in. The syntax looks like this: _refiner(&#8217;embed&#8217;, &#8216;&lt;SURVEY-ID>&#8217;, &#8216;&lt;HTML-ELEMENT-ID>&#8217;); Use an alias for the survey You&#8217;ll find an option to provide&hellip;<\/p>\n","category_list_v2":"","author_info_v2":{"name":"Moritz Dausinger","url":"https:\/\/refiner.io\/docs\/author\/user\/"},"comments_num_v2":"0 comments","yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Generate Embed Code<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generate Embed Code\" \/>\n<meta property=\"og:description\" content=\"Locate the embed code When creating an Embed Survey, you\u2019ll see an \u201cEmbed Code\u201d tab in the survey editor. This is where you can grab a Javascript code snippet that you need to include in the page where you want to render the survey. Structure of the embed code The provided embed code call the [...]Read More...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Refiner Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-08T13:34:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-1024x701.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/\",\"url\":\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/\",\"name\":\"Generate Embed Code\",\"isPartOf\":{\"@id\":\"https:\/\/refiner.io\/docs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-1024x701.png\",\"datePublished\":\"2024-06-17T14:58:17+00:00\",\"dateModified\":\"2025-09-08T13:34:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#primaryimage\",\"url\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21.png\",\"contentUrl\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21.png\",\"width\":2280,\"height\":1560},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/refiner.io\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Generate Embed Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/refiner.io\/docs\/#website\",\"url\":\"https:\/\/refiner.io\/docs\/\",\"name\":\"Refiner Documentation\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/refiner.io\/docs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/refiner.io\/docs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/refiner.io\/docs\/#organization\",\"name\":\"Refiner Documentation\",\"url\":\"https:\/\/refiner.io\/docs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/refiner.io\/docs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2022\/11\/cropped-Group-8.png\",\"contentUrl\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2022\/11\/cropped-Group-8.png\",\"width\":400,\"height\":61,\"caption\":\"Refiner Documentation\"},\"image\":{\"@id\":\"https:\/\/refiner.io\/docs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Generate Embed Code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/","og_locale":"en_US","og_type":"article","og_title":"Generate Embed Code","og_description":"Locate the embed code When creating an Embed Survey, you\u2019ll see an \u201cEmbed Code\u201d tab in the survey editor. This is where you can grab a Javascript code snippet that you need to include in the page where you want to render the survey. Structure of the embed code The provided embed code call the [...]Read More...","og_url":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/","og_site_name":"Refiner Documentation","article_modified_time":"2025-09-08T13:34:47+00:00","og_image":[{"url":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-1024x701.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/","url":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/","name":"Generate Embed Code","isPartOf":{"@id":"https:\/\/refiner.io\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#primaryimage"},"image":{"@id":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#primaryimage"},"thumbnailUrl":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21-1024x701.png","datePublished":"2024-06-17T14:58:17+00:00","dateModified":"2025-09-08T13:34:47+00:00","breadcrumb":{"@id":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#primaryimage","url":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21.png","contentUrl":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-17-at-16.52.21.png","width":2280,"height":1560},{"@type":"BreadcrumbList","@id":"https:\/\/refiner.io\/docs\/kb\/embed-surveys\/generate-embed-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/refiner.io\/docs\/"},{"@type":"ListItem","position":2,"name":"Generate Embed Code"}]},{"@type":"WebSite","@id":"https:\/\/refiner.io\/docs\/#website","url":"https:\/\/refiner.io\/docs\/","name":"Refiner Documentation","description":"","publisher":{"@id":"https:\/\/refiner.io\/docs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/refiner.io\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/refiner.io\/docs\/#organization","name":"Refiner Documentation","url":"https:\/\/refiner.io\/docs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/refiner.io\/docs\/#\/schema\/logo\/image\/","url":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2022\/11\/cropped-Group-8.png","contentUrl":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2022\/11\/cropped-Group-8.png","width":400,"height":61,"caption":"Refiner Documentation"},"image":{"@id":"https:\/\/refiner.io\/docs\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase\/26157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/types\/knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/comments?post=26157"}],"version-history":[{"count":5,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase\/26157\/revisions"}],"predecessor-version":[{"id":27589,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase\/26157\/revisions\/27589"}],"wp:attachment":[{"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/media?parent=26157"}],"wp:term":[{"taxonomy":"knowledgebase_tag","embeddable":true,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase_tag?post=26157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}