Documentation ¶
Index ¶
- Constants
- Variables
- func DelClient(names ...string)
- func Init(ctx context.Context, configs ...Config) (err error)
- type Config
- type GoAdmob
- func (c *GoAdmob) AuthUrl() string
- func (c *GoAdmob) Exchange(ctx context.Context, code string) (*oauth2.Token, error)
- func (c *GoAdmob) GetAdUnits() (*admob.ListAdUnitsResponse, error)
- func (c *GoAdmob) GetApps() (*admob.ListAppsResponse, error)
- func (c *GoAdmob) GetReport(req *ReportReq) ([]*ResponseItem, error)
- func (o *GoAdmob) Refresh() error
- func (c *GoAdmob) RefreshToken() error
- type ReportReq
- type ResponseItem
Constants ¶
View Source
const ( AD_REQUESTS = "AD_REQUESTS" CLICKS = "CLICKS" ESTIMATED_EARNINGS = "ESTIMATED_EARNINGS" IMPRESSIONS = "IMPRESSIONS" IMPRESSION_CTR = "IMPRESSION_CTR" IMPRESSION_RPM = "IMPRESSION_RPM" MATCHED_REQUESTS = "MATCHED_REQUESTS" MATCH_RATE = "MATCH_RATE" SHOW_RATE = "SHOW_RATE" )
Variables ¶
View Source
var DefaultMetrics = []string{AD_REQUESTS, CLICKS, ESTIMATED_EARNINGS, IMPRESSIONS, IMPRESSION_CTR, IMPRESSION_RPM, MATCHED_REQUESTS, MATCH_RATE, SHOW_RATE}
Functions ¶
Types ¶
type Config ¶
type Config struct { Name string `yaml:"Name" json:"name,optional"` AccountId string `yaml:"AccountId" json:"accountId,optional"` ClientId string `yaml:"ClientId" json:"clientId"` ClientSecret string `yaml:"ClientSecret" json:"clientSecret"` RedirectUrl string `yaml:"RedirectUrl" json:"redirectUrl"` State string `yaml:"State" json:"state"` AccessToken string `yaml:"AccessToken" json:"accessToken"` RefreshToken string `yaml:"RefreshToken" json:"refreshToken"` }
type GoAdmob ¶
type GoAdmob struct { Config Config AuthConfig oauth2.Config AdmobService *admob.Service Token *oauth2.Token // contains filtered or unexported fields }
accessToken 会在60分钟后过期
func (*GoAdmob) GetAdUnits ¶
获取当前appId下所有的广告信息
func (*GoAdmob) GetReport ¶
func (c *GoAdmob) GetReport(req *ReportReq) ([]*ResponseItem, error)
dimensions 指定查询维度,如:[]string{"DATE", "APP", "COUNTRY"}
SELECT DATE, APP, COUNTRY, CLICKS, ESTIMATED_EARNINGS FROM NETWORK_REPORT WHERE DATE >= '2021-09-01' AND DATE <= '2021-09-30'
AND COUNTRY IN ('US', 'CN')
GROUP BY DATE, APP, COUNTRY ORDER BY APP ASC, CLICKS DESC;
type ReportReq ¶ added in v1.2.109
type ReportReq struct { Dimensions []string //查询维度列表 AdUnits []string //广告位 Countries []string //国家 AdFormats []string //原生、横幅、插屏、开屏、激励视频 Platforms []string //应用的移动操作系统平台(例如“Android”或“iOS”)。 AppVersionNames []string //对于 Android,应用版本名称可以在 PackageInfo 中的 versionName 中找到。对于 iOS,可以在 CFBundleShortVersionString 中找到应用版本名称。警告:该维度与 ESTIMATED_EARNINGS 和 OBSERVED_ECPM 指标不兼容。 MaxReportRows int64 //最大返回数量 Metrics []string //查询字段、注意:这里的查询字段在不同的纬度下有互斥情况 StartDate admob.Date EndDate admob.Date }
Click to show internal directories.
Click to hide internal directories.