简体   繁体   中英

How can i filter data from google adsense api using page url?

i need to send custom filter to google adsense api v2

something like this


$optParams = array(
  'filters' => array(
    "URL_CHANNEL_NAME=@https://example.com/test/*"
    //or "URL_CHANNEL_NAME==https://example.com/test/"
  )
);

to get only earnings for this url "https://example.com/test" or "https://example.com/test/*"

i have tried "URL_CHANNEL_NAME==https://example.com/test/" or even "URL_CHANNEL_NAME==https://example.com/test/" but reponse always null enter image description here

You can use regex to target all channels that begin with a certain URL

$optParams = [
    'filters' => [
        'URL_CHANNEL_NAME=@^https://example\.com/test'
     ]
);

There is also "contains" but "contains" with URLs can in edge-case scenarios return undesirable results:

URL_CHANNEL_NAME@https://example.com/test

It also could just have no data for the date range you're using, you won't receive anything if that is the case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM