{"_id":"55c18618c0777c0d004676e1","project":"55aa7d973be8f60d00041d42","version":{"_id":"55aa7d983be8f60d00041d45","__v":20,"project":"55aa7d973be8f60d00041d42","createdAt":"2015-07-18T16:23:52.273Z","releaseDate":"2015-07-18T16:23:52.273Z","categories":["55aa7d983be8f60d00041d46","55aacf4e3be8f60d00041d89","55aacfaae2bdcb0d00c7466e","55aacfb3e2bdcb0d00c7466f","55aacfca3be8f60d00041d8a","55b67da3f8105a2f00c351ab","55b7cae4aea7c8190058ba5b","55b9218afeef5135009b7db3","55c182616d7d2921006da013","5631407afa40240d007c8c60","56548b9c9c4c6d0d00aeda0c","572b9137ff3ba10e00b4abb4","572b9150ff3ba10e00b4abb5","581b83288ca41f0f007e4fb6","585065fa70cbe00f00835bb8","58641eba0355f31900380492","58861760b4816e19005c9941","58a316cb254c401b00a049ce","58ac80dbd5e1570f00d1c328","59f72b4991121a00104f036e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":8,"category":{"_id":"55c182616d7d2921006da013","pages":["55c184d1c6e9ad3700aaea9c","55c18618c0777c0d004676e1","55c7917eb9aa4e0d0016c3a0"],"version":"55aa7d983be8f60d00041d45","__v":3,"project":"55aa7d973be8f60d00041d42","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-05T03:26:25.875Z","from_sync":false,"order":1,"slug":"javascript-api","title":"Javascript API"},"parentDoc":null,"githubsync":"","user":"55aa7d625d3abb0d0012f3da","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-05T03:42:16.316Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"We offer a Javascript API that gives you flexibility and control over the behavior of the Cliengo chatbot, conversion pixels, submit forms, etc. You can decide, how, when and where to display the chatbot on your site, or disable/enabled some features in your website specific pages.\n\nFor using Leadaki Javascript API:\n  * Make sure you have installed the latest Leadaki Installation code in your website.\n  * For specific settings, place leadakiSettings in your webpage before Cliengo Installation code.\n\n## Installation\nYour Cliengo Installation Code is a javascript similar to this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!-- Cliengo Installation Code -->\\n<script type=\\\"text/javascript\\\">\\n(function(){\\n  var ldk=document.createElement('script'); \\n  ldk.type='text/javascript'; \\n  ldk.async=true;\\n ldk.src='https://s.cliengo.com/weboptimizer/{companyId}/{websiteId}.js';\\n  var s=document.getElementsByTagName('script')[0];\\n  s.parentNode.insertBefore(ldk, s);})();\\n</script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n\n\n## Configuration \nFor specific settings in your webpage, you have to set leadakiSettings object before the Installation Script. [See more details](http://developers.cliengo.com/docs/javascript-api-configuration)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script>\\n/* custom configuration goes here (developers.cliengo.com/docs/javascript-api) */  \\nwindow.leadakiSettings = {someConfig:'value'}\\n</script>\\n\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n\nWe encourage developers to write their own JavaScript to extend the Cliengo functionality on their websites. We're very excited when we see examples of the API used in creative ways. Let us know if you have an interesting implementation and we may publish it.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Support\"\n}\n[/block]\nIf you have a problem with an API call, such as it not returning the correct value or not performing the intended action, email support:::at:::cliengo.com with a link to a page where we can test the functionality and information about the steps that you've taken to debug so far.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Testing and Debugging\"\n}\n[/block]\nThe API is intended to be self-serve. Although we can't debug or write JavaScript for you, there are some helpful ways to test your own code during development:\n\n## Debugging\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script>\\n/* Use this configuration for enable Cliengo debug to console.log()  */  \\nwindow.leadakiSettings = {debug:true}\\n</script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\nOr you can set on any part of your code (after beeing loaded)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Leadaki.debug = true \",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Learning JavaScript\"\n}\n[/block]\nIf you're new to JavaScript entirely, you might want to start with one of these Online Javascript courses:  [Codecademy](http://www.codecademy.com/en/tracks/javascript), [Code School](https://www.codeschool.com/paths/javascript) and [Treehouse](http://teamtreehouse.com/features/javascript)","excerpt":"Our documentation to help you customize Leadaki to fit your website","slug":"javascript-api","type":"basic","title":"Getting started with the Javascript API"}

Getting started with the Javascript API

Our documentation to help you customize Leadaki to fit your website

We offer a Javascript API that gives you flexibility and control over the behavior of the Cliengo chatbot, conversion pixels, submit forms, etc. You can decide, how, when and where to display the chatbot on your site, or disable/enabled some features in your website specific pages. For using Leadaki Javascript API: * Make sure you have installed the latest Leadaki Installation code in your website. * For specific settings, place leadakiSettings in your webpage before Cliengo Installation code. ## Installation Your Cliengo Installation Code is a javascript similar to this: [block:code] { "codes": [ { "code": "<!-- Cliengo Installation Code -->\n<script type=\"text/javascript\">\n(function(){\n var ldk=document.createElement('script'); \n ldk.type='text/javascript'; \n ldk.async=true;\n ldk.src='https://s.cliengo.com/weboptimizer/{companyId}/{websiteId}.js';\n var s=document.getElementsByTagName('script')[0];\n s.parentNode.insertBefore(ldk, s);})();\n</script>", "language": "html" } ] } [/block] ## Configuration For specific settings in your webpage, you have to set leadakiSettings object before the Installation Script. [See more details](http://developers.cliengo.com/docs/javascript-api-configuration) [block:code] { "codes": [ { "code": "<script>\n/* custom configuration goes here (developers.cliengo.com/docs/javascript-api) */ \nwindow.leadakiSettings = {someConfig:'value'}\n</script>\n", "language": "html" } ] } [/block] We encourage developers to write their own JavaScript to extend the Cliengo functionality on their websites. We're very excited when we see examples of the API used in creative ways. Let us know if you have an interesting implementation and we may publish it. [block:api-header] { "type": "basic", "title": "Support" } [/block] If you have a problem with an API call, such as it not returning the correct value or not performing the intended action, email support@cliengo.com with a link to a page where we can test the functionality and information about the steps that you've taken to debug so far. [block:api-header] { "type": "basic", "title": "Testing and Debugging" } [/block] The API is intended to be self-serve. Although we can't debug or write JavaScript for you, there are some helpful ways to test your own code during development: ## Debugging [block:code] { "codes": [ { "code": "<script>\n/* Use this configuration for enable Cliengo debug to console.log() */ \nwindow.leadakiSettings = {debug:true}\n</script>", "language": "javascript" } ] } [/block] Or you can set on any part of your code (after beeing loaded) [block:code] { "codes": [ { "code": "Leadaki.debug = true ", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "Learning JavaScript" } [/block] If you're new to JavaScript entirely, you might want to start with one of these Online Javascript courses: [Codecademy](http://www.codecademy.com/en/tracks/javascript), [Code School](https://www.codeschool.com/paths/javascript) and [Treehouse](http://teamtreehouse.com/features/javascript)