diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 995ccdd9..b4e93fe6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,7 @@ jobs: if: github.ref == 'refs/heads/feature/add_historical_data_page' uses: 18F/analytics.usa.gov/.github/workflows/deploy.yml@develop with: + API_URL: ${{ vars.API_URL_DEV }} APP_NAME: ${{ vars.APP_NAME_DEV }} APP_URL: ${{ vars.APP_URL_DEV }} CF_ORGANIZATION_NAME: ${{ vars.CF_ORGANIZATION_NAME }} @@ -76,6 +77,7 @@ jobs: S3_BUCKET_URL: ${{ vars.S3_BUCKET_URL_DEV }} S3_SERVICE_NAME: ${{ vars.S3_SERVICE_NAME_DEV }} secrets: + API_KEY: ${{ secrets.API_KEY_DEV }} CF_USERNAME: ${{ secrets.CF_USERNAME_DEV }} CF_PASSWORD: ${{ secrets.CF_PASSWORD_DEV }} NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY_DEV }} @@ -87,6 +89,7 @@ jobs: if: github.ref == 'refs/heads/staging' uses: 18F/analytics.usa.gov/.github/workflows/deploy.yml@develop with: + API_URL: ${{ vars.API_URL_STG }} APP_NAME: ${{ vars.APP_NAME_STG }} APP_URL: ${{ vars.APP_URL_STG }} CF_ORGANIZATION_NAME: ${{ vars.CF_ORGANIZATION_NAME }} @@ -95,6 +98,7 @@ jobs: S3_BUCKET_URL: ${{ vars.S3_BUCKET_URL_STG }} S3_SERVICE_NAME: ${{ vars.S3_SERVICE_NAME_STG }} secrets: + API_KEY: ${{ secrets.API_KEY_STG }} CF_USERNAME: ${{ secrets.CF_USERNAME_STG }} CF_PASSWORD: ${{ secrets.CF_PASSWORD_STG }} NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY_STG }} @@ -106,6 +110,7 @@ jobs: if: github.ref == 'refs/heads/master' uses: 18F/analytics.usa.gov/.github/workflows/deploy.yml@develop with: + API_URL: ${{ vars.API_URL_PRD }} APP_NAME: ${{ vars.APP_NAME_PRD }} APP_URL: ${{ vars.APP_URL_PRD }} CF_ORGANIZATION_NAME: ${{ vars.CF_ORGANIZATION_NAME }} @@ -114,6 +119,7 @@ jobs: S3_BUCKET_URL: ${{ vars.S3_BUCKET_URL_PRD }} S3_SERVICE_NAME: ${{ vars.S3_SERVICE_NAME_PRD }} secrets: + API_KEY: ${{ secrets.API_KEY_PRD }} CF_USERNAME: ${{ secrets.CF_USERNAME_PRD }} CF_PASSWORD: ${{ secrets.CF_PASSWORD_PRD }} NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY_PRD }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index eb8ba860..2ad51816 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,9 @@ on: workflow_call: inputs: + API_URL: + required: true + type: string APP_NAME: required: true type: string @@ -22,6 +25,8 @@ on: required: true type: string secrets: + API_KEY: + required: true CF_USERNAME: required: true CF_PASSWORD: @@ -29,6 +34,8 @@ on: NEW_RELIC_LICENSE_KEY: env: + API_URL: ${{ inputs.API_URL }} + API_KEY: ${{ secrets.API_KEY }} APP_NAME: ${{ inputs.APP_NAME }} APP_URL: ${{ inputs.APP_URL }} CF_USERNAME: ${{ secrets.CF_USERNAME }} @@ -76,9 +83,9 @@ jobs: mv manifest.yml manifest.yml.src envsubst < manifest.yml.src > manifest.yml cat manifest.yml - - name: Run envsubst on nginx.conf to set the S3 bucket URL for the environment + - name: Run envsubst on nginx.conf to set the API URL, API key, and S3 bucket URL for the environment run: | - envsubst '${S3_BUCKET_URL}' < nginx.conf.src > nginx.conf + envsubst '${API_URL} ${API_KEY} ${S3_BUCKET_URL}' < nginx.conf.src > nginx.conf - name: Login to cloud.gov and deploy run: | set -e diff --git a/_config.yml b/_config.yml index 449778a4..3dd09f39 100644 --- a/_config.yml +++ b/_config.yml @@ -55,6 +55,8 @@ description: "Official data on web traffic to thousands of US federal government # Site's own URL url: https://analytics.usa.gov +api_url: https://analytics.usa.gov/api + # Default dropdown title, will not appear if there are no sub-pages dropdown_title: Government-Wide diff --git a/_development.yml b/_development.yml index 9dcccad7..64c0e350 100644 --- a/_development.yml +++ b/_development.yml @@ -1,5 +1,5 @@ url: http://localhost:4000 -# Use production data by default. -# To pull from dev data for home page, uncomment: -# data_url: http://localhost:4000/fake-data + +api_url: https://localhost:4000/api + data_url: http://localhost:4000/ga4-data diff --git a/_includes/data_download.html b/_includes/data_download.html index 61ae1f30..8a352ec7 100644 --- a/_includes/data_download.html +++ b/_includes/data_download.html @@ -12,6 +12,10 @@
\n Please let us know how we can improve this site and product.\n
\n\n \n A red asterisk (*) indicates a required field.\n \n
\n\n alert message\n
\nr&&(r=y);else if(v^(h*o<(p=(p+360)%360-180)&&p \n Please let us know how we can improve this site and product.\n \n \n A red asterisk (*) indicates a required field.\n \n \n alert message\n r&&(r=g);else if(v^(d*o<(p=(p+360)%360-180)&&p0){if(a>f)return;a>s&&(s=a)}if(a=n-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>s&&(s=a)}else if(h>0){if(a0)){if(a/=d,d<0){if(a0){if(a>f)return;a>s&&(s=a)}if(a=r-c,d||!(a<0)){if(a/=d,d<0){if(a>f)return;a>s&&(s=a)}else if(d>0){if(a0&&(o.a={x:l+s*h,y:c+s*d}),f<1&&(o.b={x:l+f*h,y:c+f*d}),o}}}}}}var sr=1e9;function fr(t,e,n,r){return function(l){var c,s,f,h,d,p,v,y,g,m,b,w=l,x=ir(),_=cr(t,e,n,r),k={point:L,lineStart:function(){k.point=N,s&&s.push(f=[]);m=!0,g=!1,v=y=NaN},lineEnd:function(){c&&(N(h,d),p&&g&&x.rejoin(),c.push(x.buffer()));k.point=L,g&&l.lineEnd()},polygonStart:function(){l=x,c=[],s=[],b=!0},polygonEnd:function(){l=w,c=a.merge(c);var e=function(t){for(var e=0,n=s.length,r=t[1],o=0;o0;h--)a.push(i(c)*h);for(c=0;a[c]l;s--);a=a.slice(c,s)}return a},u.tickFormat=function(t,n){if(!arguments.length)return Di;arguments.length<2?n=Di:"function"!=typeof n&&(n=a.format(n));var r=Math.max(1,e*t/u.ticks().length);return function(t){var a=t/i(Math.round(o(t)));return a*e\n
\n\n\n ×\n\n \n
\n Success\n
\n \n Error\n
\n
\n
");r.removeAttribute("hidden")}else r.removeAttribute("hidden"),o.innerHTML+="Server error. We're sorry, but this submission was not successful. The Product Team has been notified."},ajaxPost:function(t,n){var r=t.action,o=new XMLHttpRequest,a={answer_01:t.querySelector("#answer_01")&&t.querySelector("#answer_01").value,answer_02:t.querySelector("#answer_02")&&t.querySelector("#answer_02").value,answer_03:t.querySelector("#answer_03")&&t.querySelector("#answer_03").value};a.referer=e.referrer,a.hostname=window.location.hostname,a.page=window.location.pathname,a.location_code=t.querySelector("#fba_location_code")?t.querySelector("#fba_location_code").value:null,a.fba_directive=t.querySelector("#fba_directive")?t.querySelector("#fba_directive").value:null,a.language="en",o.open("POST",r),o.setRequestHeader("Content-Type","application/json; charset=UTF-8;"),o.onload=n.bind(this),o.send(JSON.stringify({submission:a}))},currentPageNumber:1,showInstructions:function(){var e=this.formComponent().getElementsByClassName("fba-instructions")[0];e&&(1==this.currentPageNumber?e.removeAttribute("hidden"):e.setAttribute("hidden",!0));var t=this.formComponent().getElementsByClassName("required-questions-notice")[0];t&&(1==this.currentPageNumber?t.removeAttribute("hidden"):t.setAttribute("hidden",!0))},pagination:function(){for(var e=document.getElementsByClassName("previous-section"),t=document.getElementsByClassName("next-section"),n=0;n