{"id":20221,"date":"2020-04-23T08:32:03","date_gmt":"2020-04-23T08:32:03","guid":{"rendered":"http:\/\/refiner.io\/documentation\/?post_type=knowledgebase&#038;p=20221"},"modified":"2025-09-08T13:19:16","modified_gmt":"2025-09-08T13:19:16","slug":"javascript","status":"publish","type":"knowledgebase","link":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/","title":{"rendered":"Copy &#038; Paste Code Snippet"},"content":{"rendered":"\n\n\n<h2 class=\"wp-block-heading\" id=\"code\">Locate the code snippet<\/h2>\n\n\n\n<p>To launch Refiner surveys inside your application you need to install our JavaScriptSDK  first. Installing the necessary code snippet usually takes a couple of minutes and you only need to do it once.<\/p>\n\n\n\n<p>Go to your Refiner project and locate our code snippet under SETTINGS > JavaScript SDK.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"609\" src=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-1024x609.png\" alt=\"\" class=\"wp-image-25800\" srcset=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-1024x609.png 1024w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-800x475.png 800w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-768x456.png 768w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-1536x913.png 1536w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-2048x1217.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"identify\">Logged-in user vs Website Visitors<\/h2>\n\n\n\n<p>When grabbing your code, please check if you want to <a href=\"https:\/\/refiner.io\/docs\/kb\/javascript-client\/anonymous-vs-identified-users-mode\/\">identify users<\/a> or if you want to operate the client in Anonymous Users mode. Which of the two operation modes you chose depends on your use-case. You can read more about the two operation modes <a href=\"https:\/\/refiner.io\/docs\/kb\/javascript-client\/anonymous-vs-identified-users-mode\/\">here<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"772\" src=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-12.03.51-1024x772.png\" alt=\"\" class=\"wp-image-25808\" srcset=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-12.03.51-1024x772.png 1024w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-12.03.51-800x603.png 800w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-12.03.51-768x579.png 768w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-12.03.51.png 1400w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>Important: If you choose to survey logged-in users, please make sure to replace the dummy data in the <em><a href=\"https:\/\/refiner.io\/docs\/kb\/javascript-client\/reference\/#identify\">identifyUser<\/a><\/em> method call with real user data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"389\" src=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.59.18-1024x389.png\" alt=\"\" class=\"wp-image-25805\" srcset=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.59.18-1024x389.png 1024w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.59.18-800x304.png 800w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.59.18-768x292.png 768w, https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.59.18.png 1378w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"insert\">Insert code snippet<\/h2>\n\n\n\n<p>Copy the code and paste it into the HTML of your web-app. The ideal location is right before the closing &lt;\/BODY&gt; tag.<\/p>\n\n\n\n<p>If you are identifying your users, make sure to replace the static values from the identifyUser method with  real user data (id, email, name, &#8230;).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"advanced\">More integration options<\/h2>\n\n\n\n<p>Once you&#8217;ve installed our JavaScript client successfully, it&#8217;s time explore all options and methods that are available. Please continue exploring all options in our <a href=\"https:\/\/refiner.io\/docs\/kb\/integrations\/javascript-integration\/\">Client Reference<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Locate the code snippet To launch Refiner surveys inside your application you need to install our JavaScriptSDK first. Installing the necessary code snippet usually takes a couple of minutes and you only need to do it once. Go to your Refiner project and locate our code snippet under SETTINGS > JavaScript SDK. Logged-in user vs [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/\">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-20221","knowledgebase","type-knowledgebase","status-publish","hentry","knowledgebase_cat-install-client"],"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 code snippet To launch Refiner surveys inside your application you need to install our JavaScriptSDK first. Installing the necessary code snippet usually takes a couple of minutes and you only need to do it once. Go to your Refiner project and locate our code snippet under SETTINGS > JavaScript SDK. Logged-in user vs Website Visitors When grabbing your code, please check if you want to identify users or if you want to operate the client in Anonymous Users mode. Which of the two operation modes you chose depends on your use-case. You can read more about the two&hellip;<\/p>\n","category_list_v2":"","author_info_v2":{"name":"Moritz Dausinger","url":"https:\/\/refiner.io\/docs\/author\/user\/"},"comments_num_v2":"0 comments","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Copy &amp; Paste Code Snippet<\/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\/install-client\/javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Copy &amp; Paste Code Snippet\" \/>\n<meta property=\"og:description\" content=\"Locate the code snippet To launch Refiner surveys inside your application you need to install our JavaScriptSDK first. Installing the necessary code snippet usually takes a couple of minutes and you only need to do it once. Go to your Refiner project and locate our code snippet under SETTINGS &gt; JavaScript SDK. Logged-in user vs [...]Read More...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Refiner Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-08T13:19:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-1024x609.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\/install-client\/javascript\/\",\"url\":\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/\",\"name\":\"Copy & Paste Code Snippet\",\"isPartOf\":{\"@id\":\"https:\/\/refiner.io\/docs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-1024x609.png\",\"datePublished\":\"2020-04-23T08:32:03+00:00\",\"dateModified\":\"2025-09-08T13:19:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#primaryimage\",\"url\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15.png\",\"contentUrl\":\"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15.png\",\"width\":2534,\"height\":1506},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/refiner.io\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Copy &#038; Paste Code Snippet\"}]},{\"@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":"Copy & Paste Code Snippet","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\/install-client\/javascript\/","og_locale":"en_US","og_type":"article","og_title":"Copy & Paste Code Snippet","og_description":"Locate the code snippet To launch Refiner surveys inside your application you need to install our JavaScriptSDK first. Installing the necessary code snippet usually takes a couple of minutes and you only need to do it once. Go to your Refiner project and locate our code snippet under SETTINGS > JavaScript SDK. Logged-in user vs [...]Read More...","og_url":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/","og_site_name":"Refiner Documentation","article_modified_time":"2025-09-08T13:19:16+00:00","og_image":[{"url":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-1024x609.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\/install-client\/javascript\/","url":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/","name":"Copy & Paste Code Snippet","isPartOf":{"@id":"https:\/\/refiner.io\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#primaryimage"},"image":{"@id":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15-1024x609.png","datePublished":"2020-04-23T08:32:03+00:00","dateModified":"2025-09-08T13:19:16+00:00","breadcrumb":{"@id":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#primaryimage","url":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15.png","contentUrl":"https:\/\/refiner.io\/docs\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-11-at-11.55.15.png","width":2534,"height":1506},{"@type":"BreadcrumbList","@id":"https:\/\/refiner.io\/docs\/kb\/install-client\/javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/refiner.io\/docs\/"},{"@type":"ListItem","position":2,"name":"Copy &#038; Paste Code Snippet"}]},{"@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\/20221","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=20221"}],"version-history":[{"count":70,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase\/20221\/revisions"}],"predecessor-version":[{"id":27554,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase\/20221\/revisions\/27554"}],"wp:attachment":[{"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/media?parent=20221"}],"wp:term":[{"taxonomy":"knowledgebase_tag","embeddable":true,"href":"https:\/\/refiner.io\/docs\/wp-json\/wp\/v2\/knowledgebase_tag?post=20221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}