Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter darrencarlin

    (@darrencarlin)

    Hi Milind,

    Heres some correspondence which may shed some light on the issue:

    ****

    We noticed a low success rate on your amp inventory. We measure this metric by: 

    Video imps/(Responses*Win Rate (%)). which means the amount of ads that were actually presented to the users. 

    We believe the issue may be related to a change in the implementation, specifically the placement of the amp-consent script tag on the body instead of the head.

    And it does not contain the ‘custom-element’ as it should.

    Could you please remove the line marked above from the body and add this line to the head:

    <script async custom-element=”amp-consent” src=”https://cdn.ampproject.org/v0/amp-consent-0.1.js“></script>

    ****


    When we use wp_head function, it doesn’t work, the script is moved from the head to the body. We’re aware now that amp-script tags can only appear in the body. Were just wondering is there a way to achieve having the script tag in the head?

    Thread Starter darrencarlin

    (@darrencarlin)

    If I include it as a regular <script/> tag it gets removed on AMP pages.

    We are being asked a 3rd party provider to include the consent script in the <Head/> of the page.

    Is that possible at all?

    Thread Starter darrencarlin

    (@darrencarlin)

    Hi Milind,

    Unfortunately when I simply use <amp-script> tags, all of the scripts appear in the body. I’ve included an updated code example and screenshot to show the issue.

      function func_name() {
        if ( function_exists( 'amp_is_request' ) && amp_is_request() ) {
          error_log('AMP Request') // This logs correctly
          ?>
          <amp-script src="https://cdn.ampproject.org/v0.js"></amp-script>
          <amp-script src="https://cdn.ampproject.org/v0/amp-consent-0.1.js"></amp-script>
          <amp-script src="https://cdn.ampproject.org/v0/amp-video-docking-0.1.js"></amp-script>
          <amp-script src="https://cdn.ampproject.org/v0/amp-video-iframe-0.1.js"></amp-script>
          <style amp-custom>
            .dynamite-block.cta-article-wrapper.video-in-article, 
            .dynamite-block.cta-article-wrapper.video-in-article amp-video-iframe {
              min-width: 100%;
            }
          </style>
        <?php
        }
Viewing 3 replies - 1 through 3 (of 3 total)