• Resolved frenchomatic

    (@frenchomatic)


    This code appears to run even if no analytics is defined. This means it loads whatever and creates an error in the AMP validator.

    add_action(‘amp_post_template_head’,’ampforwp_register_analytics_script’, 20);
    function ampforwp_register_analytics_script(){ ?>
    <script async custom-element=”amp-analytics” src=”https://cdn.ampproject.org/v0/amp-analytics-0.1.js”></script&gt;
    <?php

    }

    Needs to be tested to see if any analytics has been set up in the admin panel. If not the script should not be included or it will produce a warning and very shortly google will say it is an error.

    • This topic was modified 7 years, 4 months ago by frenchomatic.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Analytics’ is closed to new replies.