Amphtml: Amp experiment throws on a zero %

Created on 2 Sep 2016  ยท  7Comments  ยท  Source: ampproject/amphtml

I just tried to turn off an experiment while I was debugging something by setting the % to zero and got this rather contradictory error

Uncaught Error: failed to build: amp-experiment#6: Invalid percentage expViewability:0. Has to be in range of (0,100)โ€‹โ€‹โ€‹ _reported_

<amp-experiment>
  <script type="application/json">
    {
      "aExperiment": {
        "sticky":false,
        "variants":{
          "expViewability":0,
          "expStd":100
        }
     }
   }
 </script>
</amp-experiment>
When Possible Documentation DiscussioQuestion analytics

Most helpful comment

not Has to be in range of (0,100)โ€‹โ€‹โ€‹

That's math notation. We could be more explicit with "greater than 0 and less than 100".

All 7 comments

/ to @lannka

@jpettitt this is as intended. the error message is explaining: we don't allow variant with 0 traffic.

In your case, you should just remove the experiment. There's no point to keep it there to waste CPU cycles and bandwidth to load and run the code.

Please let me know if you have objection.

The it should say Has to be in range of (1,100)โ€‹โ€‹โ€‹ not Has to be in range of (0,100)โ€‹โ€‹โ€‹

not Has to be in range of (0,100)โ€‹โ€‹โ€‹

That's math notation. We could be more explicit with "greater than 0 and less than 100".

+1. Let's do it more explicitly.

looks like the error message was updated in #4871, but docs still:

A name-to-percentage map where percentage is a float number in range (0, 100) that indicates the amount of traffic will be allocated to the variant.

https://www.ampproject.org/docs/reference/components/amp-experiment

The notation (a, b) implies a < x < b see intervals. Admittedly (0,100) is confusing at first (it got me, I originally this issue) but it is the correct notation (ISO 31-11). I'm going to re-open and assign to @bpaduch to see if she wants to make it clearer in the doc.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmajoulet picture gmajoulet  ยท  3Comments

sryze picture sryze  ยท  3Comments

sryze picture sryze  ยท  3Comments

mrjoro picture mrjoro  ยท  3Comments

torch2424 picture torch2424  ยท  3Comments