├── .github
└── FUNDING.yml
├── README.md
└── script.py
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [dunncreativess]
2 | custom: ['https://www.blockchain.com/btc/address/166MyypvJaqqDCGxyZ37pwCYc9jT4jNWhg https://etherscan.io/address/0xAc34E16776c768226aA416836b63f403f35a28f3']
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | If you found this repo useful, consider clicking the sponsor button near the top :) Sponsoring via GitHub is as little as $1/month and if you do not use banks or credit cards, there are crypto links included :)
2 | If you found this repo useful, consider hitting the 'sponsor' button near the top :)
3 |
4 |
5 |
6 | # Redirect.comBuyingAndZeroPark.comSelling
7 | A script that maximizes inputs and outputs to optimize profits while buying traffic on Redirect.com and selling on ZeroPark.com
8 |
9 | This script expects a file results.txt with campaign names then a comma then campaign IDs from Redirect.com.
10 |
11 | This script expects your target URL for ZeroPark to have the Target name (ie. the part of the URL preceding the ?) to match exactly the Campaign Name as specified on Redirect.com.
12 |
13 | Don't use the provided results.txt file - replace it with your own campaigns.
14 |
15 | The 'rate' variable reflects the expected ROI from the script. At 2.05, you can expect this script to usually return 205% ROI. The lower the value, the more traffic and the higher the cost.
16 |
17 | The script will first try to accurately determine the CPM of a given campaign, by dividing the revenues shown on ZeroPark with the total traffic sent from Redirect.com over the last 3 calendar days. If it can't make this calculation, it will 'guess' the CPM by dividing the CPM reported on ZeroPark by a constant.
18 |
19 | Next, it will set an optimised bid based on the 'rate' variable.
20 |
21 | For those low-CPM campaigns (think Geos like China, India) it will then re-adjust the bid to be more than $0.20 (the bare minimum to receive traffic) based on some factors - but will always remain profitable.
22 |
23 | Thanks for having a look!
24 |
25 | -Jarett
26 |
--------------------------------------------------------------------------------
/script.py:
--------------------------------------------------------------------------------
1 | import requests
2 | import json
3 | from datetime import date, timedelta
4 | import time
5 | rate = 2.05
6 | redirectAPI = 'Enter your Redirect.com API key here'
7 | URL = 'https://panel.zeropark.com/api/publisher/stats/targets?endDate=' + time.strftime('%d/%m/%Y') + '&interval=CUSTOM&limit=9000&sortOrder=DESC&startDate=' + (date.today() - timedelta(2)).strftime('%d/%m/%Y')
8 | LOGIN_URL = 'https://panel.zeropark.com/signin?referer=/' # Or whatever the login request url is
9 | payload = { 'password': 'ZeroPark Publisher Account Password', 'email': 'ZeroPark Publisher Account Password'}
10 | while True:
11 | time.sleep(0.1)
12 | s = requests.Session()
13 | try:
14 | response = s.post(LOGIN_URL, data=payload)
15 | targets = s.get(URL)
16 | targetsList = json.loads(targets.content)['elements']
17 | visits = s.get('http://api.theparkingplace.com/api/campaignreporting?apikey=' + redirectAPI + '&startdate=' + (date.today() - timedelta(2)).strftime('%m/%d/%Y') + '&enddate=' + time.strftime('%m/%d/%Y') + '&format=json')
18 | except Exception as e:
19 | print e
20 | visit = {}
21 | cost = {}
22 | for v in json.loads(visits.content)['results']['result']:
23 |
24 | visit[(str)(v['campaignname'].lower())] = (float)(v['total_visitors'])
25 | cost[(str)(v['campaignname'].lower())] = (float)(v['cost'])
26 | cancel = False
27 | for value in targetsList:
28 | with open("results.txt") as fp:
29 | if value['sellableVisits'] > 5:
30 | for i, line in enumerate(fp):
31 | if line[0:line.index(',')].lower() == value['targetAddress']:
32 | print value['targetAddress']
33 |
34 | if (value['revenue'] != 0.00):
35 | try:
36 | cpm = 1000 * (value['revenue'] / visit[value['targetAddress']])
37 | print 'Rev: $' + (str)(value['revenue']) + ', cpm calculated perfectly at ' + (str) (cpm) + " with " + (str) (value['sellableVisits']) + " sellable and " + (str)(value['soldVisits']) + " sold."
38 | except Exception as e:
39 | cpm = value['cpm'] / 1.5
40 | print 'Rev: $' + (str)(value['revenue']) + ', cpm calculted imperfectly, guess is ' + (str) (cpm) + " with " + (str) (value['sellableVisits']) + " sellable and " + (str) (value['soldVisits']) + " sold."
41 | else:
42 | cpm = value['cpm'] / 1.5
43 | print 'Rev=0.00, cpm calculted imperfectly, guess is ' + (str) (cpm) + " with " + (str) (value['sellableVisits']) + " sellable and " + (str) (value['soldVisits']) + " sold."
44 |
45 | cpm2 = value['cpm']
46 | if cpm2 < cpm:
47 | cpm = cpm2
48 | if cpm == 0.0:
49 | cpm
50 | if value['sellableVisits'] > 1000:
51 | cpm = 0.1
52 | else:
53 | cpm = 0.2
54 | bid = (cpm / rate)
55 | if (bid < .2 and cpm >= .23):
56 | bid = .21
57 | if value['revenue'] == 0.00 and value['sellableVisits'] < 1000:
58 | bid = .5
59 | elif (bid < .2 and cpm >= .21 and cpm <= .23):
60 | bid = .2
61 | elif (bid < .2 and cpm < .2):
62 | bid = .01
63 | if value['targetAddress'] == 'us-scraps' and bid <= 4.25:
64 | print 'us scraps bid should be ' + (str)(bid)
65 | bid = bid * 1.3
66 | if (value['targetAddress'] == 'us-2' or value['targetAddress'] == 'ca-2' or value['targetAddress'] == 'uk-2') and bid <= 2:
67 | print 'us/ca/uk 2 bid should be ' + (str)(bid)
68 | bid = bid * 1.3
69 | try:
70 | if (float)(cost[value['targetAddress']]) > .4:
71 | print 'bid set at ' + (str)(bid)
72 | URL2 = 'http://api.theparkingplace.com/api/editcampaign?apikey=' + redirectAPI + '&format=json&max_bid=' + (str) (bid) + '&id=' + line[line.index(',') + 1:len(line)]
73 | try:
74 | optimize = s.get(URL2)
75 | #print optimize.content
76 | except Exception as e:
77 | print e
78 | else:
79 | bid = bid * rate * .75
80 | print 'bid adjusted up, set at ' + (str)(bid)
81 | URL2 = 'http://api.theparkingplace.com/api/editcampaign?apikey=' + redirectAPI + '&format=json&max_bid=' + (str) (bid) + '&id=' + line[line.index(',') + 1:len(line)]
82 | try:
83 | optimize = s.get(URL2)
84 | #print optimize.content
85 | except Exception as e:
86 | print e
87 | except Exception as e:
88 | print 'NO COST INFO bid set at ' + (str)(bid)
89 | URL2 = 'http://api.theparkingplace.com/api/editcampaign?apikey=' + redirectAPI + '&format=json&max_bid=' + (str) (bid) + '&id=' + line[line.index(',') + 1:len(line)]
90 | try:
91 | optimize = s.get(URL2)
92 | #print optimize.content
93 | except Exception as e:
94 | print e
95 | if cancel == True:
96 | with open("results.txt") as fp:
97 | for i, line in enumerate(fp):
98 | if line[0:line.index(',')].lower() == value['targetAddress']:
99 | URL2 = 'http://api.theparkingplace.com/api/pausecampaign?apikey=' + redirectAPI + '&format=json&id=' + line[line.index(',') + 1:len(line)]
100 | try:
101 | pause = s.get(URL2)
102 | #print pause.content
103 | except Exception as e:
104 | print e
105 | print 'Done loop'
106 | time.sleep(60 * 15)
107 |
--------------------------------------------------------------------------------