是否可以从广告对象获取leadgen表单(与广告相关联)?

时间:2017-04-12 16:49:52

标签: facebook facebook-graph-api facebook-ads-api facebook-marketing-api

在Business Manager上,每个Facebook Lead Ad都与leadgen表单相关联(每当我创建一个广告时,我也会为它创建一个新表单)。因此,应该可以检索附加到广告的铅原形式。

我知道我可以通过图表链接和页面标记获取所有的leadgen表单,但这还不够,因为无法确定哪个表单与哪个广告相关联。

也就是说,这是我通过在广告帐户中查询广告获得的回复:

[data:protected] => Array
    (
        [account_id] => 
        [ad_review_feedback] => 
        [adlabels] => 
        [adset] => Array
            (
                [id] => 123123123123123
            )

        [adset_id] => 123123123123123
        [bid_amount] => 
        [bid_info] => 
        [bid_type] => ABSOLUTE_OCPM
        [campaign] => Array
            (
                [id] => 123123123123123
            )

        [campaign_id] => 123123123123123
        [configured_status] => ACTIVE
        [conversion_specs] => Array
            (
                [0] => Array
                    (
                        [action.type] => Array
                            (
                                [0] => leadgen
                            )

                        [leadgen] => Array
                            (
                                [0] => 123123123123442
                            )

                    )

            )

        [created_time] => 2017-04-10T16:40:00-0400
        [creative] => Array
            (
                [id] => 123123123123123
            )

        [effective_status] => CAMPAIGN_PAUSED
        [id] => 12312312312312312
        [last_updated_by_app_id] => 123123123123123
        [name] => My Ad
        [recommendations] => Array
            (
                [0] => Array
                    (
                        [title] => Creative Is Not Eligible For Instagram
                        [message] => Creative is not eligible for Instagram. Your ad will still be eligible to show in other placements. Instagram feed video duration can not be longer than 60 seconds.
                        [code] => 1942020
                        [importance] => HIGH
                        [confidence] => HIGH
                        [blame_field] => creative
                    )

            )

        [status] => ACTIVE
        [tracking_specs] => Array
            (
                [0] => Array
                    (
                        [action.type] => Array
                            (
                                [0] => post_engagement
                            )

                        [page] => Array
                            (
                                [0] => 123123123123123
                            )

                        [post] => Array
                            (
                                [0] => 123123123123123
                            )

                    )

                [1] => Array
                    (
                        [action.type] => Array
                            (
                                [0] => link_click
                            )

                        [post] => Array
                            (
                                [0] => 123123123123123
                            )

                        [post.wall] => Array
                            (
                                [0] => 123123123123123
                            )

                    )

            )

        [updated_time] => 2017-04-10T16:40:53-0400
        [date_format] => 
        [display_sequence] => 0
        [execution_options] => 
        [redownload] => 
        [filename] => 
    )

这是我的广告对象,因为我可以获得很多东西,广告广告,广告帐户,广告系列,广告等等...如果我能获得leadgen表单链接或ID会很棒来自其中一个地方!

让我最困惑的是我认为上面的响应中的leadgen数组是我需要的表单ID,但它似乎是我查询的每个广告对象的相同ID,我甚至都不知道是什么ID(不是表格ID)。

感谢任何和所有帮助。

更新

在挖掘Facebook寻找不相关的东西时,我偶然发现了这个:

$ad = new Ad(<AD_ID>);
$leads = $ad->getLeads();

所以我想,以下是可行的:

    // My Ad Object
    $ads = $account->getAds(array(
        AdFields::AD_REVIEW_FEEDBACK,
        AdFields::ADLABELS,
        AdFields::ADSET,
        AdFields::ADSET_ID,
        AdFields::BID_AMOUNT,
        AdFields::BID_INFO,
        AdFields::BID_TYPE,
        AdFields::CAMPAIGN,
        AdFields::CAMPAIGN_ID,
        AdFields::CONFIGURED_STATUS,
        AdFields::CONVERSION_SPECS,
        AdFields::CREATED_TIME,
        AdFields::CREATIVE,
        AdFields::EFFECTIVE_STATUS,
        AdFields::LAST_UPDATED_BY_APP_ID,
        AdFields::NAME,
        AdFields::RECOMMENDATIONS,
        AdFields::STATUS,
        AdFields::TRACKING_SPECS,
        AdFields::UPDATED_TIME,
        AdFields::DATE_FORMAT,
        AdFields::DISPLAY_SEQUENCE,
        AdFields::EXECUTION_OPTIONS,
        AdFields::REDOWNLOAD,
        AdFields::FILENAME
        ));

    foreach ($ads as $ad) {
        print_r($ad->getLeads(array(
            LeadFields::AD_ID,
            LeadFields::AD_NAME,
            LeadFields::ADSET_ID,
            LeadFields::ADSET_NAME,
            LeadFields::CAMPAIGN_ID,
            LeadFields::CAMPAIGN_NAME,
            LeadFields::CREATED_TIME,
            LeadFields::CUSTOM_DISCLAIMER_RESPONSES,
            LeadFields::FIELD_DATA,
            LeadFields::FORM_ID,
            LeadFields::ID,
            LeadFields::IS_ORGANIC,
            LeadFields::POST
            )));

但是,我在那里获得了每个广告字段,但我没有从主要对象中获取任何字段

1 个答案:

答案 0 :(得分:0)

除了我上面提到的getLeads()方法之外,似乎现在没办法从广告中获得铅原形式;哪个工作正常,但只有在该表格上有引线时才会返回。如果没有任何潜在客户(如果广告系列尚未启动通常没有,等等)......目前无法确定哪种表单通过API与广告相关联。