本文介绍了如何在设定的时间段内过滤Facebook线索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook API v4获取潜在客户列表(使用PHP和库中内置的get方法.我想知道如何将日期范围传递到请求中,以便仅获取2个日期之间的潜在客户

I'm using the Facebook API v4 to get a list of the leads(using PHP and the get method built into the library. I want to know how to pass a date range into the request to only get leads between 2 dates.

我首先使用以下方法获取广告列表:

I'm first getting a list of adets using the following:

    $request = $fb->get(
        $account_id . '/ads?fields=name&limit=100&transport=cors',
        $access_token
    );

然后,我遍历这些广告ID以获得一系列潜在客户:

Then I'm looping over those ads id's to get an array of leads:

    foreach ($adSets as $ad){
        $request = $fb->get(
            $ad['id'] . '/leads?fields=ad_name,adset_name,campaign_name,created_time,field_data&limit=100',
            $access_token
        );

        $request->getGraphEdge()->asArray();
    }

这一切都很好,但是我想获得2个日期之间的潜在客户列表.过滤部分 https://developers下的文档. facebook.com/docs/marketing-api/guides/lead-ads/retrieving/提示我可以通过以及from_date和to_date,但我似乎无法满足上述要求.

This all works perfectly fine but I want to get a list of leads between 2 dates. The documentation here under the filtering section https://developers.facebook.com/docs/marketing-api/guides/lead-ads/retrieving/ hints I can pass and from_date and to_date but I can't seem to get that working with my above request.

关于如何传递日期范围的任何想法?

Any ideas on how I can pass a date range?

推荐答案

您应过滤字段time_created

在此处提交文档:

curl -G \
  --data-urlencode 'filtering=[
    {
      "field": "time_created",
      "operator": "GREATER_THAN",
      "value": 1516682744
    }
  ]' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v4.0/<AD_ID>/leads

请记住:

希望获得帮助

这篇关于如何在设定的时间段内过滤Facebook线索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 21:49
查看更多