diff --git a/app/code/Tawk/Widget/Block/Adminhtml/SelectWidgetBlock.php b/app/code/Tawk/Widget/Block/Adminhtml/SelectWidgetBlock.php
new file mode 100644
index 0000000000000000000000000000000000000000..6ed479fb3d495b01bee77dc5bbc6c83f36d22479
--- /dev/null
+++ b/app/code/Tawk/Widget/Block/Adminhtml/SelectWidgetBlock.php
@@ -0,0 +1,173 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Block\Adminhtml;
+
+use Magento\Backend\Block\Template;
+use Tawk\Widget\Model\WidgetFactory;
+
+class SelectWidgetBlock extends Template
+{
+    const BASE_URL = 'https://plugins.tawk.to';
+    protected $logger; 
+    protected $modelWidgetFactory;
+
+    public function __construct(Template\Context $context, WidgetFactory $modelFactory, array $data = []) 
+    {
+        parent::__construct($context, $data);
+        $this->logger  = $context->getLogger();
+        $this->modelWidgetFactory = $modelFactory;
+    }
+
+    function mainurl(){
+        if(isset($_SERVER['HTTPS'])){
+            $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
+        }
+        else{
+            $protocol = 'http';
+        }
+        return $protocol . "://" . $_SERVER['HTTP_HOST'];
+    }
+    
+    public function getWebSiteoptions(){
+        $sdstr = '';
+
+        $websites = $this->_storeManager->getWebsites();
+        #$sdstr .= '<option value="0">Select Store</option>';
+        foreach ($websites as $website) {
+            $sdstr .= '<option value="'.$website->getId().'">'.$website->getName().'</option>';
+        }
+        return $sdstr;
+    }
+
+    public function _prepareLayout()
+    {
+        return parent::_prepareLayout();
+    }
+
+    public function getIframeUrl()
+    {
+        /*
+        return $this->getBaseUrl()
+            .'/generic/widgets'
+            .'?parentDomain='.$this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB)
+            .'&selectType=singleIdSelect'
+            .'&selectText=Store';
+        */
+        
+        return $this->getBaseUrl().'/generic/widgets'
+                .'?currentWidgetId=&currentPageId=&transparentBackground=1'
+                .'&parentDomain='.$this->mainurl();
+
+    }
+
+    public function getBaseUrl() {
+        return self::BASE_URL;
+    }
+
+    public function getHierarchy() {
+        $websites = $this->_storeManager->getWebsites();
+
+        $h = array();
+
+        $h[] = array(
+            'id'      => 'global',
+            'name'    => 'Global',
+            'childs'  => array(),
+            'current' => $this->getCurrentValuesFor('global')
+        );
+
+        foreach ($websites as $website) {
+            $parsed = array();
+
+            $parsed['id']      = $website->getId();
+            $parsed['name']    = $website->getName();
+            $parsed['childs']  = $this->parseGroups($website->getGroups());
+            $parsed['current'] = $this->getCurrentValuesFor($website->getId());
+
+            $h[] = $parsed;
+        }
+
+        return $h;
+    }
+
+    public function getCollection(){
+        return $this->modelWidgetFactory->create()->getCollection();
+    }
+
+    public function getFormAction() {
+        return $this->getUrl('widget/savewidget', ['_secure' => true]);
+    }
+
+    public function getRemoveUrl() {
+        return $this->getUrl('widget/removewidget', ['_secure' => true]);
+    }
+
+    public function getStoreWidget(){
+        return $this->getUrl('widget/storewidget', ['_secure' => true]);
+    }
+
+    private function parseGroups($groups) {
+        $return = array();
+
+        foreach ($groups as $group) {
+            $parsed = array();
+
+            $parsed['id']      = $group->getWebsiteId().'_'.$group->getId();
+            $parsed['name']    = $group->getName();
+            $parsed['childs']  = $this->parseStores($group->getStores());
+            $parsed['current'] = $this->getCurrentValuesFor($parsed['id']);
+
+            $return[] = $parsed;
+        }
+
+        return $return;
+    }
+
+    private function parseStores($stores) {
+        $return = array();
+
+        foreach ($stores as $store) {
+            $parsed = array();
+
+            $parsed['id']      = $store->getWebsiteId().'_'.$store->getGroupId().'_'.$store->getId();
+            $parsed['name']    = $store->getName();
+            $parsed['childs']  = array();
+            $parsed['current'] = $this->getCurrentValuesFor($parsed['id']);
+
+            $return[] = $parsed;
+        }
+
+        return $return;
+    }
+
+    private function getCurrentValuesFor($id) {
+        $widgets = $this->getCollection();
+
+        foreach ($widgets as $widget) {
+            if($widget->getForStoreId() === $id) {
+                return array(
+                    'pageId'   => $widget->getPageId(),
+                    'widgetId' => $widget->getWidgetId()
+                );
+            }
+        }
+
+        return array();
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Block/Embed.php b/app/code/Tawk/Widget/Block/Embed.php
new file mode 100644
index 0000000000000000000000000000000000000000..2456a0110b43b15f8f74bbc7d3870a8cdd02f3d9
--- /dev/null
+++ b/app/code/Tawk/Widget/Block/Embed.php
@@ -0,0 +1,153 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Block;
+
+use Magento\Framework\View\Element\Template;
+use Tawk\Widget\Model\WidgetFactory;
+
+class Embed extends Template
+{
+	const TAWK_EMBED_URL = 'https://embed.tawk.to';
+	protected $modelWidgetFactory;
+	protected $logger;
+	protected $model;
+	protected $storeManager;
+
+	public function __construct(WidgetFactory $modelFactory, Template\Context $context, array $data = [])
+	{
+		parent::__construct($context, $data);
+		$this->modelWidgetFactory = $modelFactory;
+		$this->storeManager       = $context->getStoreManager();
+		$this->logger             = $context->getLogger();
+		$this->model              = $this->getWidgetModel();
+	}
+
+	public function getEmbedUrl()
+	{
+		return self::TAWK_EMBED_URL.'/'.$this->model->getPageId().'/'.$this->model->getWidgetId();
+	}
+
+	private function getWidgetModel()
+	{
+		$store = $this->storeManager->getStore();
+
+		$storeId   = $store->getId();
+		$groupId   = $store->getGroup()->getId();
+		$websiteId = $store->getWebsite()->getId();
+
+		$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+
+		//order in which we select widget
+		$ids = array($websiteId.'_'.$groupId.'_'.$storeId, $websiteId.'_'.$groupId, $websiteId, 'global');
+
+		foreach ($ids as $id) {
+			$tmpModel = $objectManager->get('Tawk\Widget\Model\Widget')->loadByForStoreId($id);
+
+			if($tmpModel->hasId()) {
+				return $tmpModel;
+			}
+		}
+
+		return null;
+	}
+
+	protected function _toHtml()
+	{
+		if(is_null($this->model)) {
+			return '';
+		}
+
+		$alwaysdisplay = $this->model->getAlwaysDisplay();
+		$donotdisplay = $this->model->getDoNotDisplay();
+		$display = true;
+
+		if($alwaysdisplay == 1){
+			$display = true;
+			
+			$excluded_url_list = $this->model->getExcludeUrl();
+
+			if(strlen( $excluded_url_list ) > 0 )
+			{
+				$current_url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
+				$current_url = urldecode($current_url);
+
+				$ssl      = ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' );
+			    $sp       = strtolower( $_SERVER['SERVER_PROTOCOL'] );
+			    $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' );
+
+			    $current_url = $protocol.'://'.$current_url;
+			    $current_url = strtolower($current_url);
+
+			    #$exclude_url = trim( strtolower( $this->model->getExcludeUrl() ) );
+			    $current_url = trim( strtolower( $current_url ) );
+				
+				
+				$excluded_url_list = preg_split("/,/", $excluded_url_list);
+
+				foreach($excluded_url_list as $exclude_url)
+				{
+			    	$exclude_url = strtolower(urldecode(trim($exclude_url)));
+			    	if (strpos($current_url, $exclude_url) !== false) 
+					{
+						$display = false;
+					}
+				}
+			}
+		}else{
+			$display = false;
+		}
+
+
+		if($donotdisplay == 1){
+			$display = false;
+
+			$included_url_list = $this->model->getIncludeUrl();
+			if(strlen( $included_url_list ) > 0 )
+			{
+				$current_url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
+				$current_url = urldecode($current_url);
+
+				$ssl      = ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on' );
+			    $sp       = strtolower( $_SERVER['SERVER_PROTOCOL'] );
+			    $protocol = substr( $sp, 0, strpos( $sp, '/' ) ) . ( ( $ssl ) ? 's' : '' );
+
+			    $current_url = $protocol.'://'.$current_url;
+			    $current_url = strtolower($current_url);
+
+			    $current_url = trim( strtolower( $current_url ) );
+
+				$included_url_list = preg_split("/,/", $included_url_list);
+				foreach($included_url_list as $include_url)
+				{
+			    	$exclude_url = strtolower(urldecode(trim($include_url)));
+			    	if (strpos($current_url, $include_url) !== false) 
+					{
+						$display = true;
+					}
+				}
+			}
+		}
+		
+		if($display == true){		
+			return parent::_toHtml();
+		}else{
+			return '';
+		}
+	}
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Controller/Adminhtml/GoToDashboard/Index.php b/app/code/Tawk/Widget/Controller/Adminhtml/GoToDashboard/Index.php
new file mode 100644
index 0000000000000000000000000000000000000000..1a2e82030a0f4c13623096abf2bd6f072ca0f360
--- /dev/null
+++ b/app/code/Tawk/Widget/Controller/Adminhtml/GoToDashboard/Index.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Controller\Adminhtml\GoToDashboard;
+
+use Magento\Framework\Controller\ResultFactory;
+
+class Index extends \Magento\Backend\App\Action
+{
+	protected function _isAllowed()
+    {
+        return $this->_authorization->isAllowed('Tawk_Widget::tawk_go_to_dashboard');
+    }
+
+    public function execute()
+    {
+        $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
+        return $resultRedirect->setUrl('https://dashboard.tawk.to/');
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Controller/Adminhtml/RemoveWidget/Index.php b/app/code/Tawk/Widget/Controller/Adminhtml/RemoveWidget/Index.php
new file mode 100644
index 0000000000000000000000000000000000000000..b159a88e148171fd344a4e3e14dd3ef11504e1c6
--- /dev/null
+++ b/app/code/Tawk/Widget/Controller/Adminhtml/RemoveWidget/Index.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Controller\Adminhtml\RemoveWidget;
+
+use Magento\Backend\App\Action\Context;
+use Magento\Framework\Controller\Result\JsonFactory;
+use Psr\Log\LoggerInterface;
+
+class Index extends \Magento\Backend\App\Action
+{
+    protected $resultJsonFactory;
+    protected $logger;
+
+    public function __construct(Context $context, JsonFactory $resultJsonFactory, LoggerInterface $logger)
+    {
+        parent::__construct($context);
+        $this->resultJsonFactory = $resultJsonFactory;
+        $this->logger = $logger;
+    }
+
+    public function execute()
+    {
+        $response = $this->resultJsonFactory->create();
+        $response->setHeader('Content-type', 'application/json');
+        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+        $objectManager->get('Tawk\Widget\Model\Widget')->loadByForStoreId(filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING))->delete();
+
+        return $response->setData(['success' => TRUE]);
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Controller/Adminhtml/SaveWidget/Index.php b/app/code/Tawk/Widget/Controller/Adminhtml/SaveWidget/Index.php
new file mode 100644
index 0000000000000000000000000000000000000000..1d786b90118e02f05b27098b4dce7ced30995cf0
--- /dev/null
+++ b/app/code/Tawk/Widget/Controller/Adminhtml/SaveWidget/Index.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Controller\Adminhtml\SaveWidget;
+
+use Magento\Framework\Controller\Result\JsonFactory;
+use Magento\Backend\App\Action\Context;
+use Psr\Log\LoggerInterface;
+
+class Index extends \Magento\Backend\App\Action
+{
+    protected $resultJsonFactory;
+    protected $logger;
+
+    public function __construct(Context $context, JsonFactory $resultJsonFactory, LoggerInterface $logger)
+    {
+        parent::__construct($context);
+        $this->resultJsonFactory = $resultJsonFactory;
+        $this->logger = $logger;
+    }
+
+    public function execute()
+    {
+        $response = $this->resultJsonFactory->create();
+        $response->setHeader('Content-type', 'application/json');
+
+        if(!is_string(filter_input(INPUT_POST, 'pageId', FILTER_SANITIZE_STRING)) || !is_string(filter_input(INPUT_POST, 'widgetId', FILTER_SANITIZE_STRING)) || !is_string(filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING))) {
+            return $response->setData(['success' => FALSE]);
+        }
+
+        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+        $model = $objectManager->get('Tawk\Widget\Model\Widget')->loadByForStoreId(filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING));
+
+        if( ($_POST['pageId'] == '-1') && ($_POST['widgetId'] == '-1') ){
+
+        }else{
+            $model->setPageId(filter_input(INPUT_POST, 'pageId', FILTER_SANITIZE_STRING));
+            $model->setWidgetId(filter_input(INPUT_POST, 'widgetId', FILTER_SANITIZE_STRING));
+        }
+        $model->setForStoreId($_POST['id']);
+
+        $model->setAlwaysDisplay($_POST['alwaysdisplay']);
+        $model->setExcludeUrl($_POST['excludeurl']);
+
+        $model->setDoNotDisplay($_POST['donotdisplay']);
+        $model->setIncludeUrl($_POST['includeurl']);
+
+        $model->save();
+
+        return $response->setData(['success' => TRUE]);
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Controller/Adminhtml/SelectWidget/Index.php b/app/code/Tawk/Widget/Controller/Adminhtml/SelectWidget/Index.php
new file mode 100644
index 0000000000000000000000000000000000000000..3ca91e255b682436bb61c1c61a4ec39114cbfbfe
--- /dev/null
+++ b/app/code/Tawk/Widget/Controller/Adminhtml/SelectWidget/Index.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Controller\Adminhtml\SelectWidget;
+
+use Magento\Backend\App\Action\Context;
+use Magento\Framework\View\Result\PageFactory;
+
+class Index extends \Magento\Backend\App\Action
+{
+    protected $resultPageFactory;
+    
+    protected function _isAllowed()
+    {
+    	return $this->_authorization->isAllowed('Tawk_Widget::tawk_choose_widget');
+    }
+
+    public function __construct(Context $context, PageFactory $resultPageFactory) {
+        parent::__construct($context);
+        $this->resultPageFactory = $resultPageFactory;
+    }
+
+    public function execute()
+    {
+        return  $resultPage = $this->resultPageFactory->create();
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Controller/Adminhtml/StoreWidget/Index.php b/app/code/Tawk/Widget/Controller/Adminhtml/StoreWidget/Index.php
new file mode 100644
index 0000000000000000000000000000000000000000..d698d55092fecd7082fe9aa13fb550b3876254ad
--- /dev/null
+++ b/app/code/Tawk/Widget/Controller/Adminhtml/StoreWidget/Index.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Controller\Adminhtml\StoreWidget;
+
+use Magento\Framework\Controller\Result\JsonFactory;
+use Magento\Backend\App\Action\Context;
+use Psr\Log\LoggerInterface;
+
+class Index extends \Magento\Backend\App\Action
+{
+    protected $resultJsonFactory;
+    protected $logger;
+
+    public function __construct(Context $context, JsonFactory $resultJsonFactory, LoggerInterface $logger)
+    {
+        parent::__construct($context);
+        $this->resultJsonFactory = $resultJsonFactory;
+        $this->logger = $logger;
+    }
+
+    public function execute()
+    {
+        $response = $this->resultJsonFactory->create();
+        $response->setHeader('Content-type', 'application/json');
+
+        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+        $model = $objectManager->get('Tawk\Widget\Model\Widget')->loadByForStoreId(filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING));
+
+        if(!$model->hasId()) {
+            $model = $objectManager->get('Tawk\Widget\Model\Widget');
+        }
+
+        $pageId = $model->getPageId();
+        $widgetId =  $model->getWidgetId();
+
+
+        $alwaysdisplay = $model->getAlwaysDisplay();
+        $excludeurl = $model->getExcludeUrl();
+
+        $donotdisplay = $model->getDoNotDisplay();
+        $includeurl = $model->getIncludeUrl();
+
+        return $response->setData(['success' => TRUE,'pageid' => $pageId,'widgetid' => $widgetId,'alwaysdisplay' => $alwaysdisplay,'excludeurl' => $excludeurl,'donotdisplay' => $donotdisplay,'includeurl' => $includeurl]);
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Model/ResourceModel/Widget.php b/app/code/Tawk/Widget/Model/ResourceModel/Widget.php
new file mode 100644
index 0000000000000000000000000000000000000000..bbdf9ffc3dbe63b93c5660dae047b05e068e2447
--- /dev/null
+++ b/app/code/Tawk/Widget/Model/ResourceModel/Widget.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Model\ResourceModel;
+ 
+use \Magento\Framework\Model\ResourceModel\Db\AbstractDb;
+
+class Widget extends AbstractDb
+{
+    protected function _construct() {
+        $this->_init('tawk_widget', 'id');
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Model/ResourceModel/Widget/Collection.php b/app/code/Tawk/Widget/Model/ResourceModel/Widget/Collection.php
new file mode 100644
index 0000000000000000000000000000000000000000..e435860739b29a03c3a3e22f7249c99d81c1a237
--- /dev/null
+++ b/app/code/Tawk/Widget/Model/ResourceModel/Widget/Collection.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Model\ResourceModel\Widget;
+ 
+use \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
+ 
+class Collection extends AbstractCollection
+{
+    protected function _construct()
+    {
+        $this->_init('Tawk\Widget\Model\Widget', 'Tawk\Widget\Model\ResourceModel\Widget');
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Model/Widget.php b/app/code/Tawk/Widget/Model/Widget.php
new file mode 100644
index 0000000000000000000000000000000000000000..7ec4d5da9387e118d9b9fc7bb57b20abde3d7a1f
--- /dev/null
+++ b/app/code/Tawk/Widget/Model/Widget.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Model;
+
+use \Magento\Framework\Model\AbstractModel;
+
+class Widget extends AbstractModel
+{
+	protected function _construct()
+	{
+		$this->_init('Tawk\Widget\Model\ResourceModel\Widget');
+	}
+
+	public function loadByForStoreId($id) 
+	{
+		return $this->getCollection()
+			->addFieldToFilter('for_store_id', $id)
+			->getFirstItem();
+	}
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/README.md b/app/code/Tawk/Widget/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..8e8d46a3680f3708cb0cfb74e4d3448c7eaf6613
--- /dev/null
+++ b/app/code/Tawk/Widget/README.md
@@ -0,0 +1,5 @@
+Magento Tawk.to Live Chat Module
+
+This module adds Tawk.to Live Chat to your Magento 2 site.
+
+To install and set up your tawk.to account, please follow this documentation https://www.tawk.to/knowledgebase/plugins-and-modules/magento-2-integration/
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/Setup/InstallSchema.php b/app/code/Tawk/Widget/Setup/InstallSchema.php
new file mode 100644
index 0000000000000000000000000000000000000000..2b93e060e0db4795c79ddc789a6297b24c125d64
--- /dev/null
+++ b/app/code/Tawk/Widget/Setup/InstallSchema.php
@@ -0,0 +1,88 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Tawk\Widget\Setup;
+
+use Magento\Framework\Setup\InstallSchemaInterface;
+use Magento\Framework\Setup\SchemaSetupInterface;
+use Magento\Framework\Setup\ModuleContextInterface;
+use Magento\Framework\DB\Ddl\Table;
+
+class InstallSchema implements InstallSchemaInterface
+{
+    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
+    {
+        $setup->startSetup();
+
+        $table = $setup->getConnection()->newTable($setup->getTable('tawk_widget'))->addColumn(
+            'id',
+            Table::TYPE_INTEGER,
+            10,
+            ['identity' => true, 'unsigned' => false, 'nullable' => false, 'primary' => true],
+            'Id'
+        )->addColumn(
+            'for_store_id',
+            Table::TYPE_TEXT,
+            50,
+            [],
+            'For store Id'
+        )->addColumn(
+            'page_id',
+            Table::TYPE_TEXT,
+            50,
+            [],
+            'Page Id'
+        )->addColumn(
+            'widget_id',
+            Table::TYPE_TEXT,
+            50,
+            [],
+            'Widget Id'
+        )->addColumn(
+            'always_display',
+            Table::TYPE_INTEGER,
+            1,
+            [],
+            'always_display'
+        )->addColumn(
+            'exclude_url',
+            Table::TYPE_TEXT,
+            255,
+            [],
+            'exclude_url'
+        )->addColumn(
+            'do_not_display',
+            Table::TYPE_INTEGER,
+            1,
+            [],
+            'do_not_display'
+        )->addColumn(
+            'include_url',
+            Table::TYPE_TEXT,
+            255,
+            [],
+            'include_url'
+        )->setComment(
+            'Tawk Widget table that makes connection between stores and widgets'
+        );
+
+        $setup->getConnection()->createTable($table);
+
+        $setup->endSetup();
+    }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/composer.json b/app/code/Tawk/Widget/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..28835f67a8fcb122e4f6f8dafa38f6caa2daf512
--- /dev/null
+++ b/app/code/Tawk/Widget/composer.json
@@ -0,0 +1,18 @@
+{
+  "name": "tawk/widget",
+  "description": "Tawk live chat widget",
+  "type": "magento2-module",
+  "version": "1.0.0",
+  "license": [
+    "OSL-3.0"
+  ],
+  "require": {
+    "php": "~5.6.0|7.0.2|7.0.4|~7.0.12"
+  },
+  "autoload": {
+    "files": [ "registration.php" ],
+    "psr-4": {
+      "Tawk\\Widget\\": ""
+    }
+  }
+}
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/etc/acl.xml b/app/code/Tawk/Widget/etc/acl.xml
new file mode 100644
index 0000000000000000000000000000000000000000..58c8211a03feedf1e2d5c8d0e154b644ff6f5e44
--- /dev/null
+++ b/app/code/Tawk/Widget/etc/acl.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+-->
+
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
+    <acl>
+        <resources>
+            <resource id="Magento_Backend::admin">
+                <resource id="Tawk_Widget::tawk" title="Tawk.to Widget" sortOrder="10" >
+                    <resource id="Tawk_Widget::tawk_choose_widget" title="Select your widget" sortOrder="0" />
+                    <resource id="Tawk_Widget::tawk_go_to_dashboard" title="Go to dashboard" sortOrder="100" />
+                </resource>
+            </resource>
+        </resources>
+    </acl>
+</config>
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/etc/adminhtml/menu.xml b/app/code/Tawk/Widget/etc/adminhtml/menu.xml
new file mode 100644
index 0000000000000000000000000000000000000000..692e4086aecec970cfb15c49cab2877c41ba03a4
--- /dev/null
+++ b/app/code/Tawk/Widget/etc/adminhtml/menu.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+-->
+
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
+    <menu>
+	  	<add id="Tawk_Widget::tawk" title="Tawk.to Widget" module="Tawk_Widget" sortOrder="100" parent="Magento_Backend::system" resource="Tawk_Widget::tawk"/>
+	    <add id="Tawk_Widget::tawk_choose_widget" title="Select your widget" module="Tawk_Widget" sortOrder="50" parent="Tawk_Widget::tawk" action="widget/selectwidget" resource="Tawk_Widget::tawk"/>
+	    <add id="Tawk_Widget::tawk_go_to_dashboard" title="Go to dashboard" module="Tawk_Widget" sortOrder="50" parent="Tawk_Widget::tawk" action="widget/gotodashboard" resource="Tawk_Widget::tawk"/>
+    </menu>
+</config>
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/etc/adminhtml/routes.xml b/app/code/Tawk/Widget/etc/adminhtml/routes.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9de48f18f9a08dc920d1562b5cb372a603cb5b5a
--- /dev/null
+++ b/app/code/Tawk/Widget/etc/adminhtml/routes.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+-->
+
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
+	<router id="admin">
+		<route id="widget" frontName="widget">
+			<module name="Tawk_Widget"/>
+		</route>
+	</router>
+</config>
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/etc/module.xml b/app/code/Tawk/Widget/etc/module.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fe97efdbbd6c7b28bafe16d79586aa33e75f66f9
--- /dev/null
+++ b/app/code/Tawk/Widget/etc/module.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<!--
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+-->
+
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
+	<module name="Tawk_Widget" setup_version="1.3.1"/>
+</config>
diff --git a/app/code/Tawk/Widget/registration.php b/app/code/Tawk/Widget/registration.php
new file mode 100644
index 0000000000000000000000000000000000000000..ab65c2bce8278e7064c3768b6da95177e410bb67
--- /dev/null
+++ b/app/code/Tawk/Widget/registration.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+\Magento\Framework\Component\ComponentRegistrar::register(
+    \Magento\Framework\Component\ComponentRegistrar::MODULE,
+    'Tawk_Widget',
+    __DIR__
+);
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/view/adminhtml/layout/widget_selectwidget_index.xml b/app/code/Tawk/Widget/view/adminhtml/layout/widget_selectwidget_index.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ef1fc6be1562bebf2b9ed0dfe766f9c86d629087
--- /dev/null
+++ b/app/code/Tawk/Widget/view/adminhtml/layout/widget_selectwidget_index.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+-->
+
+<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
+    <head>
+        <title>
+            Select your widget
+        </title>
+    </head>
+    <body>
+        <referenceContainer name="content">
+            <block class="Tawk\Widget\Block\Adminhtml\SelectWidgetBlock" name="tawk_widget.select" template="Tawk_Widget::selectwidget.phtml"/>
+        </referenceContainer>
+    </body>
+</page>
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/view/adminhtml/templates/selectwidget.phtml b/app/code/Tawk/Widget/view/adminhtml/templates/selectwidget.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..e1cba67b747c8076bb098d2ff6399b4e8de5baae
--- /dev/null
+++ b/app/code/Tawk/Widget/view/adminhtml/templates/selectwidget.phtml
@@ -0,0 +1,338 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+?>
+ <style>
+
+.websiteids:focus{
+	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);
+	border-color: #66afe9;
+	outline:0 none;
+
+}
+.websiteids {
+    width: 350px;
+    background-color: #fff;
+    background-image: none;
+    border: 1px solid #ccc;
+    border-radius: 4px;
+    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
+    color: #555;
+    font-size: 14px;
+    height: 34px;
+    line-height: 1.42857;
+    padding: 6px 12px;
+    transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
+
+}
+
+.websiteids_label {
+    display: inline-block;
+    font-size: 15px;
+    font-weight: bold;
+    width: 200px;
+}
+
+.tawk_fields{
+	margin:15px 0;
+}
+
+.switch {
+  position: relative;
+  display: inline-block;
+  width: 60px;
+  height: 34px;
+}
+
+/* Hide default HTML checkbox */
+.switch input {display:none;}
+
+/* The slider */
+.slider {
+  position: absolute;
+  cursor: pointer;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background-color: #ccc;
+  -webkit-transition: .4s;
+  transition: .4s;
+}
+
+.slider:before {
+  position: absolute;
+  content: "";
+  height: 26px;
+  width: 26px;
+  left: 4px;
+  bottom: 4px;
+  background-color: white;
+  -webkit-transition: .4s;
+  transition: .4s;
+}
+
+input:checked + .slider {
+  background-color: #2196F3;
+}
+
+input:focus + .slider {
+  box-shadow: 0 0 1px #2196F3;
+}
+
+input:checked + .slider:before {
+  -webkit-transform: translateX(26px);
+  -ms-transform: translateX(26px);
+  transform: translateX(26px);
+}
+
+/* Rounded sliders */
+.slider.round {
+  border-radius: 34px;
+}
+
+.slider.round:before {
+  border-radius: 50%;
+}
+
+.savesettingsbtn{
+	background-color: #5cb85c;
+    border-color: #4cae4c;
+    color: #fff;
+   -moz-user-select: none;
+    background-image: none;
+    border: 1px solid transparent;
+    border-radius: 4px;
+    cursor: pointer;
+    display: inline-block;
+    font-size: 14px;
+    font-weight: normal;
+    line-height: 1.42857;
+    margin-bottom: 0;
+    padding: 6px 12px;
+    text-align: center;
+    vertical-align: middle;
+    white-space: nowrap;
+    text-decoration: none;
+}
+
+.savesettingsbtn:hover{
+	text-decoration: none;
+	color: #fff;
+}
+</style>
+<script type="text/javascript">
+    require(['jquery', 'jquery/ui'], function($){ 
+	    $.noConflict();
+	    jQuery(function() {
+	    	
+	    	jQuery.get('<?php echo $this->getStoreWidget() ?>?id=' + jQuery( "#websiteids" ).val(), function (response) {			   
+			   document.getElementById('tawk_widget_customization').src = 'https://plugins.tawk.to/generic/widgets?currentWidgetId=' + response.widgetid + '&currentPageId='+ response.pageid +'&transparentBackground=1&parentDomain=<?php echo $this->mainurl() ?>';
+
+				jQuery('#excludeurl').val(response.excludeurl);
+				jQuery('#includeurl').val(response.includeurl);
+				if(response.alwaysdisplay == 1){
+					jQuery('#alwaysdisplay').prop('checked', true);
+					jQuery("#exlucded_urls_container").show();
+				}else{
+					jQuery('#alwaysdisplay').prop('checked', false);
+					jQuery("#exlucded_urls_container").hide();
+				}
+				if(response.donotdisplay == 1){
+					jQuery('#donotdisplay').prop('checked', true);
+					jQuery("#included_urls_container").show();
+				}else{
+					jQuery('#donotdisplay').prop('checked', false);
+					jQuery("#included_urls_container").hide();
+				}
+
+			});
+			
+
+	        if(jQuery("#alwaysdisplay").prop("checked")){
+				jQuery("#exlucded_urls_container").show();
+			}else{
+				jQuery("#exlucded_urls_container").hide();
+			}
+
+			if(jQuery("#donotdisplay").prop("checked")){
+				jQuery("#included_urls_container").show();
+			}else{
+				jQuery("#included_urls_container").hide();
+			}
+
+			window.addEventListener('message', function(e) {
+	            if(e.origin === '<?php echo $this->getBaseUrl() ?>') {
+	                if(e.data.action === 'setWidget') {
+	                    setWidget(e);
+	                }
+	                if(e.data.action === 'removeWidget') {
+	                    removeWidget(e);
+	                }
+	            }
+	        });
+	        
+	        function setWidget(e) {
+	        	alwaysdisplay = jQuery('#alwaysdisplay').is(":checked");
+				var alwaysdisplayvalue = alwaysdisplay ? 1 : 0;
+
+				donotdisplay = jQuery('#donotdisplay').is(":checked");
+				var donotdisplayvalue = donotdisplay ? 1 : 0;
+
+	            jQuery.post('<?php echo $this->getFormAction() ?>', {
+	                pageId   : e.data.pageId,
+	                widgetId : e.data.widgetId,
+	                id       : jQuery('#websiteids').val(),
+	            	excludeurl : jQuery('#excludeurl').val(),
+					includeurl : jQuery('#includeurl').val(),
+					alwaysdisplay : alwaysdisplayvalue,
+					donotdisplay: donotdisplayvalue,
+	                form_key : '<?php echo $this->getFormKey() ?>'
+	            }, function(response) {
+	                e.source.postMessage({action : 'setDone'}, '<?php echo $this->getBaseUrl() ?>');
+	            });
+	        }
+
+	        function removeWidget(e) {
+	            jQuery.get('<?php echo $this->getRemoveUrl() ?>?id=' + e.data.id, function (response) {
+	                e.source.postMessage({action : 'removeDone'}, '<?php echo $this->getBaseUrl() ?>');
+	            });
+	        }
+
+	        jQuery(".savesettingsbtn" ).click(function(e) {
+				e.preventDefault();
+				alwaysdisplay = jQuery('#alwaysdisplay').is(":checked");
+				var alwaysdisplayvalue = alwaysdisplay ? 1 : 0;
+
+				donotdisplay = jQuery('#donotdisplay').is(":checked");
+				var donotdisplayvalue = donotdisplay ? 1 : 0;
+
+				jQuery.post('<?php echo $this->getFormAction() ?>', {
+					pageId     : "-1",
+					widgetId   : "-1",
+					id         : jQuery('#websiteids').val(),
+					excludeurl : jQuery('#excludeurl').val(),
+					includeurl : jQuery('#includeurl').val(),
+					alwaysdisplay : alwaysdisplayvalue,
+					donotdisplay: donotdisplayvalue,
+					form_key : '<?php echo $this->getFormKey() ?>'
+				}, function() {
+					alert('Visibility options Saved');
+				});
+			});
+
+	        jQuery('#websiteids').on('change', function() {
+	          if(this.value == 0){
+	          	document.getElementById('tawk_widget_customization').src = "";
+	          	jQuery("#visibility_options").hide();
+	          }else{
+				  jQuery.get('<?php echo $this->getStoreWidget() ?>?id=' + this.value, function (response) {			   
+					   document.getElementById('tawk_widget_customization').src = 'https://plugins.tawk.to/generic/widgets?currentWidgetId=' + response.widgetid + '&currentPageId='+ response.pageid +'&transparentBackground=1&parentDomain=<?php echo $this->mainurl() ?>';
+						jQuery("#visibility_options").show();	   
+				  });
+
+				 	jQuery('#excludeurl').val(response.excludeurl);
+					jQuery('#includeurl').val(response.includeurl);
+					if(response.alwaysdisplay == 1){
+						jQuery('#alwaysdisplay').prop('checked', true);
+						jQuery("#exlucded_urls_container").show();
+					}else{
+						jQuery('#alwaysdisplay').prop('checked', false);
+						jQuery("#exlucded_urls_container").hide();
+					}
+					if(response.donotdisplay == 1){
+						jQuery('#donotdisplay').prop('checked', true);
+						jQuery("#included_urls_container").show();
+					}else{
+						jQuery('#donotdisplay').prop('checked', false);
+						jQuery("#included_urls_container").hide();
+					}
+
+			  }	
+			});
+
+			jQuery("#alwaysdisplay").change(function() {
+				if(this.checked){
+					jQuery("#exlucded_urls_container").show();
+					jQuery('#donotdisplay').prop('checked', false);
+					jQuery("#included_urls_container").hide();
+				}else{
+					jQuery("#exlucded_urls_container").hide();
+					jQuery('#donotdisplay').prop('checked', true);
+					jQuery("#included_urls_container").show();
+				}
+			});
+
+			jQuery("#donotdisplay").change(function() {
+				if(this.checked){
+					jQuery("#included_urls_container").show();
+					jQuery('#alwaysdisplay').prop('checked', false);
+					jQuery("#exlucded_urls_container").hide();
+				}else{
+					jQuery("#included_urls_container").hide();
+					jQuery('#alwaysdisplay').prop('checked', true);
+					jQuery("#exlucded_urls_container").show();
+				}
+			});
+
+
+
+	    });
+ 	});
+</script>
+
+<label for="websiteids" class="websiteids_label">Select Store</label>
+<select name="websiteids" id="websiteids" class="websiteids">
+<?php echo $this->getWebSiteoptions(); ?>
+</select>
+
+<iframe
+    id="tawk_widget_customization"
+    style="border:none; width:100%; margin: 0 0 0 0; padding: 0 0 0 0; min-height: 300px"
+    src="<?php echo $this->getIframeUrl() ?>">
+</iframe>
+
+<div id="visibility_options">
+<h3>Visibility Options</h3>
+<div class="tawk_fields">
+	<label for="alwaysdisplay" class="websiteids_label">Always Display widget</label>
+	<label class="switch">
+	  <input type="checkbox" id= "alwaysdisplay" name="alwaysdisplay"  class="tawk_check">
+	  <div class="slider round"></div>
+	</label>
+</div>
+<div class="tawk_fields" id="exlucded_urls_container">
+	<label for="excludeurl">(Exception) hide tawk.to widget to the following URL</label>
+	<BR />
+	<textarea name="excludeurl" id="excludeurl" rows="10" style="width:80%;" ></textarea>
+</div>
+<div class="tawk_fields">
+	<label for="donotdisplay" class="websiteids_label">Do not Display widget</label>
+	<label class="switch">
+	  <input type="checkbox" value="0" id= "donotdisplay" name="donotdisplay"  class="tawk_check">
+	  <div class="slider round"></div>
+	</label>
+</div>
+<div class="tawk_fields"  id="included_urls_container">
+	<label for="includeurl">(Exception) display tawk.to widget to the following URL</label>
+	<BR />
+	<textarea name="includeurl" id="includeurl" rows="10" style="width:80%;" ></textarea>
+</div>
+<div class="tawk_fields">
+<a class="savesettingsbtn" href="#">Save Visibility Settings</a>
+</div>
+</div>
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/view/frontend/layout/default.xml b/app/code/Tawk/Widget/view/frontend/layout/default.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9f9a237c18cd53261f342e9e1ad1159f191a6b1b
--- /dev/null
+++ b/app/code/Tawk/Widget/view/frontend/layout/default.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+-->
+
+<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
+    <body>
+	    <referenceContainer name="before.body.end">
+	        <block class="Tawk\Widget\Block\Embed" name="tawk_widget.embed" template="embed.phtml" />
+	    </referenceContainer>
+    </body>
+</page>
\ No newline at end of file
diff --git a/app/code/Tawk/Widget/view/frontend/templates/embed.phtml b/app/code/Tawk/Widget/view/frontend/templates/embed.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..5b8ec87ce3c9cb6d38c98ecaa93e68cf0584a46d
--- /dev/null
+++ b/app/code/Tawk/Widget/view/frontend/templates/embed.phtml
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Tawk.to
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to support@tawk.to so we can send you a copy immediately.
+ *
+ * @copyright   Copyright (c) 2016 Tawk.to
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+?>
+
+<!--Start of Tawk.to Script-->
+<script type="text/javascript"> var $_Tawk_API={},$_Tawk_LoadStart=new Date();
+(function(){
+	var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
+	s1.async=true;
+	s1.src='<?php echo $this->getEmbedUrl() ?>';
+	s1.charset='UTF-8';
+	s1.setAttribute('crossorigin','*');
+	s0.parentNode.insertBefore(s1,s0);
+})();
+</script>
+<!--End of Tawk.to Script-->
\ No newline at end of file