Web Component wrapper for Google Analytics code using Polymer.
Maintained by Cesar William.
Using Bower:
-
Run this command from your project root:
bower install google-analytics --save
-
Import Web Components' polyfill:
<script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
-
Import the component by adding this to your HTML file:
<link rel="import" href="bower_components/google-analytics/google-analytics.html">
-
Start using it!
<google-analytics code="UA-XXXXX-Y"></google-analytics>
Attribute | Options | Default | Description |
---|---|---|---|
code |
string | UA-XXXXX-Y |
Your Google Analytics tracking code |
displayfeatures |
boolean | false |
Optional. Define the display features option |
pages |
array | [] |
Optional. The path portion of the page URL. Should begin with '/' like this '["/sample1", "/sample2"]' |
See Google Analytics official documentation.
For detailed changelog, check Releases.