Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 03caa47

Browse files
authored
refactor: enable again ethicalads keywords support (#238)
1 parent 185a23e commit 03caa47

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func initializeDatabase() {
9595
log.Fatal("failed to prepare query ", err)
9696
}
9797

98-
getUserTagsStmt, err = db.Prepare("select tag from user_tags where user_id = ?")
98+
getUserTagsStmt, err = db.Prepare("select tag from user_tags where user_id = ? order by last_read desc limit 50")
9999
if err != nil {
100100
log.Fatal("failed to prepare query ", err)
101101
}

ethicalads.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var fetchEthicalAds = func(r *http.Request, keywords []string) (*EthicalAdsAd, e
3535
}
3636
ip := getIpAddress(r)
3737
ua := r.UserAgent()
38-
var body = []byte(`{ "publisher": "dailydev", "placements": [{ "div_id": "ad-div-1", "ad_type": "image-v1" }], "campaign_types": ["paid"], "user_ip": "` + ip + `", "user_ua": "` + ua + `" }`)
38+
var body = []byte(`{ "publisher": "dailydev", "placements": [{ "div_id": "ad-div-1", "ad_type": "image-v1" }], "campaign_types": ["paid"], "user_ip": "` + ip + `", "user_ua": "` + ua + `", "keywords": [` + keywordsString + `] }`)
3939
var res EthicalAdsResponse
4040
req, _ := http.NewRequest("POST", "https://server.ethicalads.io/api/v1/decision/", bytes.NewBuffer(body))
4141
req.Header.Set("Content-Type", "application/json")

0 commit comments

Comments
 (0)