Outline for survey implementation (#27305)

This commit is contained in:
Jonah Williams 2019-02-20 15:28:28 -08:00 committed by GitHub
parent d492d7165a
commit 2acf6fdb6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,25 @@
window.ApiSurveyDocs = function(apiPages) {
var url = window.location.href;
var fragments = url.split('/');
if (fragments == null || fragments.length == 0) {
return;
}
var classFragment = fragments[fragments.length -1];
if (classFragment == null) {
return;
}
var apiDocClassFragments = classFragment.split('-');
if (apiDocClassFragments.length != 2) {
return;
}
var apiDocClass = apiDocClassFragments[0];
if (url == null || apiPages.indexOf(apiDocClass) == -1) {
return;
}
scriptElement = document.createElement('script');
scriptElement.setAttribute('src', 'https://www.google.com/insights/consumersurveys/async_survey?site=sygvgfetfwmwm7isniaym3m6f4');
document.head.appendChild(scriptElement);
}
scriptElement = document.createElement('script');
scriptElement.setAttribute('src', 'https://storage.googleapis.com/flutter-dashboard.appspot.com/api_survey/api_survey_docs.html');
document.head.appendChild(scriptElement);

View File

@ -1,3 +1,4 @@
<script async="" defer=""
src="//www.google.com/insights/consumersurveys/async_survey?site=i2bdmo2dzky7fqws25nicgx5f4">
</script>
<script async="" defer="" src="../assets/api_survey.js"></script>