protected function registerPlugin()
    {
        $id = $this->options['id'];

        //get the displayed view and register the needed assets
        $view = $this->getView();
        yii2instafeedAsset::register($view);

        $js = array();
        
        $options = Json::encode($this->clientOptions);
        $js[] = "var feed$id = new Instafeed($options);";
        $js[] = "feed$id.run();";

        $view->registerJs(implode("\n", $js),View::POS_READY);
    }