Lucas Callado | Blog    About    Archive

Installing Node.js, Bower, Polymer, and Google Analytics Web Components — A step-by-step guide

Run as root Linux:

curl --silent --location https://rpm.nodesource.com/setup | bash -

Then install, as root:

yum -y install nodejs

Upgrade npm to the latest version:

npm –g install npm@latest

Install Bower:

npm –g install bower

Install Git

yum install git

 

Change Bower settings to execute with superuser permissions

bower --allow-root init

The previous command will generate a basic bower.json file. Answer all necessary questions with information about your application.

Install Polymer

bower --allow-root install --save Polymer/polymer#^1.2.0

 

Bower adds a bower_components/ folder in the root of your project and fills it with Polymer and its dependencies.

Install Google Analytics —- Web Components

bower --allow-root install --save GoogleWebComponents/google-analytics

 

After everything is install your folder should look like this:

ga

Here is a sample code for a Google Analytics data:

<google-signin client-id="YOUR_CLIENT_ID_HERE"></google-signin>
<google-analytics-dashboard>
  <google-analytics-chart type="pie" ids="ga:YOUR_ID" metrics="ga:sessions" dimensions="ga:deviceCategory" sort="-ga:sessions" start-date="yesterday" max-results="7">
  </google-analytics-chart>
</google-analytics-dashboard>