This is what the plugin currently provides for analytics entries.

What we could do is if a user supplies googleanalytics as the type, that an additional checkbox appears to opt-in to client ID.
Really it would be ideal if this was all done automatically based on the script sanitizer described in #1032. For example, if the script sanitizer came across a script like:
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-Y', 'auto', {'useAmpClientId': true});
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
Then it should automatically convert this into:
<meta name="amp-google-client-id-api" content="googleanalytics">
<script src="https://cdn.ampproject.org/v0/amp-analytics-latest.js" async="" custom-element="amp-analytics"></script>
...
<amp-analytics id="f27ffc1d4690" type="googleanalytics">
<script type="application/json">
{
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview"
}
},
"vars": {
"account": "UA-XXXXX-Y"
}
}
</script>
</amp-analytics>
Reopening this issue to add option to admin panel.
I suggest we reveal a checkbox to opt-in to client ID specifically when googleanalytics is specified as the Type.
Is it possible to activate the client ID option in Wordpress somehow right now?
@nekromoff Try this plugin: https://gist.github.com/westonruter/a11b2c9321374c993286c01bab21bbc2
@westonruter @nekromoff @christianoliveira The Google Site Kit plugin supports AMP client ID on both sides, covering the non-AMP part as well as the AMP part.
Awesome. I think we're done here then. The next step is to soft-deprecate the Analytics admin screen by encouraging users to install one of the AMP-compatible ecosystem plugins that tailor the given analytics product to their site. See #2317.
Most helpful comment
I suggest we reveal a checkbox to opt-in to client ID specifically when
googleanalyticsis specified as the Type.