The AdMob-TgBot allows publishers to get information about their AdMob account by using their own telegram bot.
To get started quickly, follow these steps.
- Step 1: Upload the project in your server.
- Download the source code (
AdMob.zip
) from Releases. - Uncompress the zip file you download in your server. The path must be something like
/path/to/AdMob/...
- Step 2: Enable the AdMob Api.
- Visit https://console.developers.google.com to register your application.
- From the API Library, enable the AdMob API.
- Click on APIs & Services > Credentials in the left navigation menu.
- Click CREATE CREDENTIALS > OAuth client ID.
- Select Web application as the application type, give it a name, then click Create.
- From the Credentials page, Save Client ID And Client secret somewhere. (you need these in 4th step!)
- Add
/path/to/AdMob/Auth.php
to Authorized redirect URIs. (Link ofAuth.php
in your server)
- Step 3: Create a Telegram Bot.
- Create a telegram bot using botfather (See more)
- Save the token somewhere. (you need it in the next step!)
- Set the bot Webhook
https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=<BOT_LINK>
Replace<YOUR_TOKEN>
with the bot token and replace<BOT_LINK>
with/path/to/AdMob/Bot.php
. (Link ofBot.php
in your server)
- Step 4: Set AdMobOptions values.
- Open
/path/to/AdMob/AdMobOptions.php
in your server. - Replace
<TELEGRAM_TOKEN>
with your bot token that you create in step 3. - Replace
<YOUR_PUBLICATION_ID>
with your AdMob publication ID. - Replace
<YOUR_CLIENT_ID>
And<YOUR_CLIENT_SECRET>
with values which you saved in step 2. - Replace
<YOUR_REDIRECT_URI>
with/path/to/AdMob/Auth.php
. (Link ofAuth.php
in your server) - Replace
<YOUR_TELEGRAM_USER_ID>
with your userID to be admin of the bot. (You can use@userinfobot
to find your userID)
- Step 5: Login to the panel by the bot. (Only required once)
- Start the bot (With the admin account)
- Send
/token
- Click on Login (Will open oauth link)
- Login to your google account (the one which you enabled the AdMob Api)
- If you logged in successfully, The bot will send the new token to you and then everything is ready.
Done!
Admins can use the bot to add/remove subusers.
- Start the bot (With an admin account)
- Send
/addUser
- Send the subuser userID
- Send
/addAppToUser
- Select the subuser
- Send the unique ID of the application that subuser can report (must be something like
ca-app-pub-1234~1234
)
You can also add yourself as a subuser and restrict the apps that you can report.
Reports contain these information:
- 🆔 : The unique ID of AdUnit or application.
- 💰 : The estimated earnings.
- eCPM: The estimated earnings per thousand ad impressions.
- Clicks: The number of times a user clicks an ad.
- Requests: The number of ad requests.
- MatchedRequests: The number of times ads are returned in response to a request.
- Impr: The total number of ads shown to users.
- Impr. CTR: The ratio of clicks over impressions.
- ShowRate: The ratio of ads that are displayed over ads that are returned, defined as impressions / matched requests.
- MatchRate: The ratio of matched ad requests over the total ad requests.
/admob
: Will report total status of panel (Only restricted apps for subusers) order by Today, Yesterday, This month and last month./report
(DATE optional) : Reports all applications separately./reportByApp
(DATE optional) : Reports a specific application./reportByAdUnit
(DATE optional) : Reports a specific application based on the AdUnits./reportByCountry
(DATE optional) : Reports a specific application based on the Country.
DATE optional means you can set start and end date of the report. for example:
- /report Today (Or Yesterday)
- /report Last month (Or Year)
- /report This month (Or Year)
- /report 7days (X days or months or years)
- /report 2021/8/17
- /report 2021/2/4 to 2021/5/7