Viewless Components
In order create a component that is only logic and does not have a view i.e. Google Analytics Component that adds tracking info to page, you have to set it up as a "viewless" component.
Steps
- Add isViewless: true to component.config.json in your component project root.
// component.config.json
{
...
isViewless: true
}
- in your component's
<component-name>.view.jsfile addthis.setIsViewless(true)to the onInit lifecycle hook.
// <component-name>.view.js
onInit() {
this.setIsViewless(true);
}