patreon ad

This commit is contained in:
2020-06-10 18:11:00 +02:00
parent 2b06087bcc
commit 9d3af28162
2 changed files with 28 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ package webcontroller
import (
"fmt"
"io/ioutil"
"math/rand"
"mime"
"net/http"
"strconv"
@@ -32,14 +33,19 @@ func adType() (i int) {
// Intn returns a number up to n, but never n itself. So it get a random 0
// or 1 we need to give it n=2. We can use this function to make other
// splits like 1/3 1/4, etc
// i = rand.Intn(2)
i = rand.Intn(2)
// switch {
// case i == 1: // 50% of the traffic
return 1 // Amarula
// default:
// return 0 // A-Ads
// }
// The return value correstonds to the type of ad shown:
// 0: A-ads
// 1: Amarulasolutions
// 2: Patreon
switch i {
case 0: // 50% of the traffic
return 1
default:
return 2
}
}
type viewerData struct {