使用MailChimp API V3.0创建具有动态细分的广告系列 [英] Create campaign with dynamic segment using MailChimp API V3.0

查看:102
本文介绍了使用MailChimp API V3.0创建具有动态细分的广告系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用MailChimp API V3.0创建广告系列.

Using MailChimp API V3.0 to create a campaign.

我想创建一个广告系列,将其发送给具有特定兴趣的用户.看起来在文档中这是可能的,但是我已经尝试了我能想到的所有排列.只要不使用segment_ops成员,我就可以很好地创建广告系列.有没有人提供可以执行此操作的PHP代码示例?

I want to create a campaign that sends to users with a specific interest. It looks like this is possible in the docs, but I've tried every permutation I can think of. I can create the campaign fine as long as I leave out the segment_ops member. Does anyone have an example of PHP code that will do it?

似乎兴趣处理很奇怪,因为通过API设置用户兴趣时您没有包括兴趣类别.我不确定这会如何影响广告系列的创建.

It seems that interests are handled strangely since you don't include the interest-category when setting a users interests via the API. I'm not sure how this affects campaign creation.

推荐答案

我已经做到了这一点,尽管您无法从当前文档中获取该文档,但该文档未列出"Interests" condition_type或可能的"op"值.

I've gotten this to work, though there's no way you'd get it from the current docs, which don't list an 'Interests' condition_type or the possible 'op' values for it.

兴趣必须按照兴趣类别(在用户界面的某些部分称为组")进行分组.

Interests have to be grouped under interest categories (called 'Groups' in some parts of the UI).

这是收件人数组的segment_opts成员的JSON:

Here is the JSON for the segment_opts member of the recipients array:

 "segment_opts": {
        "match": "any",
        "conditions": [{
            "condition_type": "Interests",
            "field": "interests-31f7aec0ec",
            "op": "interestcontains",
            "value": ["a9014571b8", "5e824ac953"]
        }]
 }

这是带注释的PHP数组版本. 匹配"成员指条件"数组中的规则.该细分可以匹配任何,所有条件或不匹配任何条件.此示例只有一个条件,但其他示例也可以作为附加数组添加到条件"数组中:

Here is the PHP array version with comments. The 'match' member refers to the the rules in the array of 'conditions'. The segment can match any, all, or none of the conditions. This example has only one condition, but others can be added as additional arrays in the 'conditions' array:

$segment_opts = array(
'match' => 'any', // or 'all' or 'none'
'conditions' => array (
    array(
        'condition_type' => 'Interests', // note capital I
        'field' => 'interests-31f7aec0ec', // ID of interest category
                                           // This ID is tricky: it is 
                                           // the string "interests-" + 
                                           // the ID of interest category
                                           // that you get from MailChimp 
                                           // API (31f7aec0ec)
        'op' => 'interestcontains', // or interestcontainsall, interestcontainsnone
        'value' => array (
            'a9014571b8',  // ID of interest in that category
            '5e824ac953' // ID of another interest in that category
        )
    )

  )
);

这篇关于使用MailChimp API V3.0创建具有动态细分的广告系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆