Hello tagDiv Team,
I’ve just updated our dev environment to the latest version of Newspaper + the mobile theme and followed the instructions to do so.
Unfortunately, when I add Analytics and JS code to the site under “ANALYTICS/JS CODES” in the theme settings it leads to AMP failure when checking via Google with many errors. It appears that the mobile theme is attempting to convert the code into amp-friendly without success. As soon as I remove the code from this section all the amp tests pass perfectly.
An example of the code I am using is below:
<script src="//static.getclicky.com/js" type="text/javascript"></script>
<script type="text/javascript">try{ clicky.init(1234); }catch(e){}</script>
<noscript><p>
</p></noscript>
<script async src="//sub.domain.com/js"></script>
Is there any way to tell the mobile/amp theme to ignore these?
If not, could I place directly into the header.php in a child theme?
Thanks
I’ve tried what I suggested above putting these codes into the header.php of the child theme but unfortunately – this means that the code doesn’t work on mobile OR amp pages. Obviously I need the code to work on mobile but be ignored in amp due to the errors.
Could someone from tagDiv chime in please?
Hi,
Is possible that your code to make some conflicts for amp and mobile theme.
If I understand correctly you try to set this option and set the code here -> https://www.screencast.com/t/Ks8s2uSflq if this was not working that mean your coed is not longer compatible with amp version.
Thank you for your understanding!
Hi,
The only way to show in amp that code is if that code can be converted to amp.
Please check this articles:
Introduction to advertising on AMP -> https://www.ampproject.org/docs/ads/introduction_ads
Add Analytics to AMP pages -> https://developers.google.com/analytics/devguides/collection/amp-analytics/
Thank you!