Documentation ¶
Index ¶
- Constants
- type Account
- type AccountResponse
- type AllDataItem
- type AllDataResponse
- type ApiRefreshTokenRequest
- type BaseResponse
- type CampaignDetails
- type CampaignStatus
- type DataDetailResponse
- type DetailsDataRequest
- type Market
- func (m *Market) GetAccountAdsetesOutline(accountId string) (*AllDataResponse, error)
- func (m *Market) GetAccountsByBusinessId(businessId string) (*AccountResponse, error)
- func (m *Market) GetDetailsData(outlineItem *AllDataItem) (*DataDetailResponse, error)
- func (m *Market) RefreshToken(clientId string, clientSecret string) (*TokenResponse, error)
- type Paging
- type RequestData
- type TokenItem
- type TokenResponse
Constants ¶
View Source
const ( OmniActivateApp = "omni_activate_app" MobileAppInstall = "mobile_app_install" OmniPurchase = "omni_purchase" )
fb actions key
View Source
const ( ApiAccount = "/%s/client_ad_accounts" ApiAccountCampaigns = "/act_%s/campaigns" ApiAccountAdsets = "/act_%s/adsets" ApiAccountAds = "/act_%s/ads" ApiDataDetails = "/%s/insights" ApiRefreshToken = "/oauth/access_token" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Id string `json:"id,optional"` AccountId string `json:"account_id,optional"` Name string `json:"name,optional"` AccountStatus int `json:"account_status,optional"` Balance string `json:"balance,optional"` Currency string `json:"currency,optional"` }
facebook 投放账户信息结构
type AccountResponse ¶
type AccountResponse struct { BaseResponse[[]Account] }
type AllDataItem ¶
type AllDataItem struct { Name string `json:"name,optional"` Status string `json:"status,optional"` EffectiveStatus string `json:"effective_status,optional"` CampaignId string `json:"campaign_id,optional"` AccountId string `json:"account_id,optional"` AdsetId string `json:"adset_id,optional"` Id string `json:"id,optional"` }
简要数据项(冗余:如:获取广告系列数据时 CampaignId,AdsetId 都为空 )
type AllDataResponse ¶
type AllDataResponse struct { BaseResponse[[]AllDataItem] }
type ApiRefreshTokenRequest ¶
type BaseResponse ¶
type BaseResponse[T any] struct { Paging struct { Cursors struct { Before string `json:"before,optional"` After string `json:"after,optional"` } `json:"cursors,optional"` Next string `json:"next,optional"` } `json:"paging,optional"` Data T `json:"data,optional"` }
通用返回数据结构
type CampaignDetails ¶
type CampaignDetails struct { AccountId string `json:"account_id,optional"` CampaignId string `json:"campaign_id,optional"` AdsetId string `json:"adset_id,optional"` AdsetName string `json:"adset_name,optional"` AdId string `json:"ad_id,optional"` Impressions string `json:"impressions,optional"` Cpm string `json:"cpm,optional"` Cpc string `json:"cpc,optional"` Spend string `json:"spend,optional"` Clicks string `json:"clicks,optional"` Conversions string `json:"conversions,optional"` Objective string `json:"objective,optional"` CostPerUniqueClick string `json:"cost_per_unique_click,optional"` AccountName string `json:"account_name,optional"` Ctr string `json:"ctr,optional"` DateStart string `json:"date_start,optional"` DateStop string `json:"date_stop,optional"` Country string `json:"country,optional"` Actions []struct { ActionType string `json:"action_type,optional"` Value string `json:"value,optional"` } `json:"actions,optional"` }
func (*CampaignDetails) GetActionStat ¶
func (f *CampaignDetails) GetActionStat(actionType string) int64
type CampaignStatus ¶
type CampaignStatus string
const ( ACTIVE CampaignStatus = "ACTIVE" PAUSED CampaignStatus = "PAUSED" DELETED CampaignStatus = "DELETED" ARCHIVED CampaignStatus = "ARCHIVED" )
type DataDetailResponse ¶
type DataDetailResponse struct { BaseResponse[[]CampaignDetails] }
type DetailsDataRequest ¶
type DetailsDataRequest struct { RequestData TimeIncrement int `url:"time_increment"` Timezone string `url:"time_zone"` //Asia/Shanghai Breakdowns string `url:"breakdowns"` //['country'] 以国家纬度group by 查询 }
type Market ¶
type Market struct { BaseApi string AccessToken string StartDate string EndDate string PageSize int }
func (*Market) GetAccountAdsetesOutline ¶
func (m *Market) GetAccountAdsetesOutline(accountId string) (*AllDataResponse, error)
概要数据加载,下一页数据 res.Paging.Cursors.After
func (*Market) GetAccountsByBusinessId ¶
func (m *Market) GetAccountsByBusinessId(businessId string) (*AccountResponse, error)
某个商户下所有账号信息 账号余额,状态等等
func (*Market) GetDetailsData ¶
func (m *Market) GetDetailsData(outlineItem *AllDataItem) (*DataDetailResponse, error)
某个计划或者广告组所有详情数据以 国家小时为纬度的数据 res.Paging.Cursors.After 通过这个参数重新请求下一页数据
func (*Market) RefreshToken ¶
func (m *Market) RefreshToken(clientId string, clientSecret string) (*TokenResponse, error)
刷新token接口
type RequestData ¶
type RequestData struct { Limit int `url:"limit"` //Before string `json:"before"` After string `url:"after"` AccessToken string `url:"access_token"` Fields string `url:"fields"` DateStart string `url:"date_start"` DateStop string `url:"date_stop"` TimeRange string `url:"time_range"` //DateStart And DateStop are here for query }
type TokenItem ¶
type TokenItem struct { AccessToken string `json:"access_token,optional"` TokenType string `json:"token_type,optional"` ExpiresIn int `json:"expires_in,optional"` Error struct { Message string `json:"message,optional"` Type string `json:"type,optional"` Code int `json:"code,optional"` FbtraceId string `json:"fbtrace_id,optional"` } `json:"error,optional"` }
type TokenResponse ¶
type TokenResponse struct {
TokenItem
}
Click to show internal directories.
Click to hide internal directories.