google-analytics-element
google-analytics-element copied to clipboard
Web Component wrapper for Google Analytics code using Polymer
<google-analytics>
Web Component wrapper for Google Analytics code using Polymer.
Maintained by Cesar William.

Installation
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>
Options
| 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.
History
For detailed changelog, check Releases.