Repository: ProjectEvergreen/greenwood (js)

Issue:
Google Analytics plugin is making multiple init tracking requests
## Type of Change
- [ ] New Feature Request
- [ ] Documentation / Website
- [ ] Improvement / Suggestion
- [x] Bug
- [ ] Other (please clarify below)

## Summary
Noticed that on a page load the are two collect requests getting made, when there should in theory only be one and the only difference between the two is just the timestamp.
![Screen Shot 2021-09-27 at 11 45 13 AM](https://user-images.githubusercontent.com/895923/134942675-6b4b6648-888f-4a68-a99e-f8eb251510ef.png)

## Details
Was fiddling with this is a bit and noticed that there are [two `gtag` config lines](https://github.com/ProjectEvergreen/greenwood/blob/v0.16.0/packages/plugin-google-analytics/src/index.js), which probably shouldn't be there, since when removing it, only initiated one request
![Screen Shot 2021-09-27 at 11 46 12 AM](https://user-images.githubusercontent.com/895923/134942697-802265b8-d785-4813-8765-0c36f1ebb3d6.png)

which makes sense given all the [reference scripts out there](https://www.analyticsmania.com/post/google-tag-manager-vs-google-analytics/).

---

Somewhat related, we should also update our docs that this plugin can also support Measurement IDs / GA v4, e.g. `G-XXXXX` and that is recommended.
https://github.com/ContributaryCommunity/www.contributary.community/pull/98/

It loads a little more code, but makes only one request so.... YMMV 🤷‍♂️
![Screen Shot 2021-09-27 at 11 57 25 AM](https://user-images.githubusercontent.com/895923/134943522-6bb096da-a39d-47cb-a27b-f166331af792.png)

Pull request:
Bug/issue 736 double ga init requests
<!--
## Submitting a Pull Request
We love contributions and appreciate any help you can offer!
-->

## Related Issue
resolves #736 

## Summary of Changes
1. Remove extra `gtag` config call and update specs
1. Update docs to reference Measurement vs Tracking ID types

Patch:
diff --git a/packages/plugin-google-analytics/README.md b/packages/plugin-google-analytics/README.md
index 17ebf00f..df32e99c 100644
--- a/packages/plugin-google-analytics/README.md
+++ b/packages/plugin-google-analytics/README.md
@@ -19,7 +19,9 @@ yarn add @greenwood/plugin-google-analytics --dev
 ```
 
 ## Usage
-Use this plugin in your _greenwood.config.js_ and pass in your Google Analytics ID, e.g. `UA-XXXXX`.
+Use this plugin in your _greenwood.config.js_ and pass in your Google Analytics ID, which can either be a
+* Measurement ID (**recommended**): ex. `G-XXXXXX`
+* Tracking ID (legacy): ex. `UA-XXXXXX`
 
 ```javascript
 const googleAnalyticsPlugin = require('@greenwood/plugin-google-analytics');
@@ -37,6 +39,7 @@ module.exports = {
 
 This will then add the Google Analytics [JavaScript tracker snippet](https://developers.google.com/analytics/devguides/collection/analyticsjs/) to your project's _index.html_.
 
+> _Learn more about [Measurement and Tracking IDs](https://support.google.com/analytics/answer/9539598)_.
 
 ## Options
 - `analyticsId` (required) - Your Google Analytics ID
diff --git a/packages/plugin-google-analytics/src/index.js b/packages/plugin-google-analytics/src/index.js
index ec923577..a75d5f0a 100644
--- a/packages/plugin-google-analytics/src/index.js
+++ b/packages/plugin-google-analytics/src/index.js
@@ -37,7 +37,6 @@ class GoogleAnalyticsResource extends ResourceInterface {
             function gtag(){dataLayer.push(arguments);}
             gtag('js', new Date());
             gtag('config', '${analyticsId}', { 'anonymize_ip': ${trackAnon} });
-            gtag('config', '${analyticsId}');
           </script>
         </head>
         `);


Test patch:
diff --git a/packages/plugin-google-analytics/test/cases/default/default.spec.js b/packages/plugin-google-analytics/test/cases/default/default.spec.js
index f8247a44..dc0a3deb 100644
--- a/packages/plugin-google-analytics/test/cases/default/default.spec.js
+++ b/packages/plugin-google-analytics/test/cases/default/default.spec.js
@@ -87,7 +87,6 @@ describe('Build Greenwood With: ', function() {
             function gtag(){dataLayer.push(arguments);}
             gtag('js', new Date());
             gtag('config', '${mockAnalyticsId}', { 'anonymize_ip': true });
-            gtag('config', '${mockAnalyticsId}');
         `;
 
         expect(inlineScript[0].textContent).to.contain(expectedContent);
diff --git a/packages/plugin-google-analytics/test/cases/option-anonymous/option-anonymous.spec.js b/packages/plugin-google-analytics/test/cases/option-anonymous/option-anonymous.spec.js
index 5d65de4c..1799362b 100644
--- a/packages/plugin-google-analytics/test/cases/option-anonymous/option-anonymous.spec.js
+++ b/packages/plugin-google-analytics/test/cases/option-anonymous/option-anonymous.spec.js
@@ -76,7 +76,6 @@ describe('Build Greenwood With: ', function() {
             function gtag(){dataLayer.push(arguments);}
             gtag('js', new Date());
             gtag('config', '${mockAnalyticsId}', { 'anonymize_ip': false });
-            gtag('config', '${mockAnalyticsId}');
         `;
 
         expect(inlineScript[0].textContent).to.contain(expectedContent);