I've been referencing a specific example for utilizing the Google Analytics Embed API with Chart.js in my application. However, I'm encountering an issue at Step 3
where we need to include various javascript libraries.
I was successful in loading the Embed API in my application.js
as shown below:
(function(w,d,s,g,js,fs){
g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(f){this.q.push(f);}};
js=d.createElement(s);fs=d.getElementsByTagName(s)[0];
js.src='https://apis.google.com/js/platform.js';
fs.parentNode.insertBefore(js,fs);js.onload=function(){g.load('analytics');};
}(window,document,'script'));
//= require /public/javascript/Chart.min.j
//= require /public/javascript/moment.min.js
//= require /public/javascript/embed-api/date-range-selector.js
//= require /public/javascript/embed-api/active-users.js
Although it shows that the cb=gapi.loaded_0
library is being loaded in the Networks
section of the dev tools, the other libraries such as Charts.min.js
and moments.min.js
are not. While I can find these online, I am unsure of where to locate embed-api/date-range-selector.js
or embed-api/active-users.js
to include in my app?
EDIT1 I managed to find the necessary files here: https://github.com/googleanalytics/ga-dev-tools