【问题标题】:MailChimp merge_vars what else is accepted apart from FNAME & LNAME?MailChimp 合并变量除了 FNAME 和 LNAME 之外还接受什么?
【发布时间】:2012-06-05 12:23:14
【问题描述】:

我已经使用电子邮件地址+姓名实现了一个非常基本的注册,尽管我现在想添加额外的数据,例如电话号码、网站等。

我的问题是,在 API doc 中的什么位置,除了 FNAME 和 LNAME 之外,我还能找到其他支持的内容吗?

目前我有:

$merge_vars = array(
     'FNAME' => $fname,
     'LNAME' => $lname
);

我正在使用方法listSubscribe,这是上面提供的信息:

@param array $merge_vars optional merges for the email (FNAME, LNAME, etc.) (see examples below for handling "blank" arrays). Note that a merge field can only hold up to 255 bytes. Also, there are a few "special" keys:
                        string EMAIL set this to change the email address. This is only respected on calls using update_existing or when passed to listUpdateMember()
                        array GROUPINGS Set Interest Groups by Grouping. Each element in this array should be an array containing the "groups" parameter which contains a comma delimited list of Interest Groups to add. Commas in Interest Group names should be escaped with a backslash. ie, "," => "\," and either an "id" or "name" parameter to specify the Grouping - get from listInterestGroupings()
                        string OPTINIP Set the Opt-in IP fields. <em>Abusing this may cause your account to be suspended.</em> We do validate this and it must not be a private IP address.
                        array MC_LOCATION Set the members geographic location. By default if this merge field exists, we'll update using the optin_ip if it exists. If the array contains LATITUDE and LONGITUDE keys, they will be used. NOTE - this will slow down each subscribe call a bit, especially for lat/lng pairs in sparsely populated areas. Currently our automated background processes can and will overwrite this based on opens and clicks.

                        <strong>Handling Field Data Types</strong> - most fields you can just pass a string and all is well. For some, though, that is not the case...
                        Field values should be formatted as follows:
                        string address For the string version of an Address, the fields should be delimited by <strong>2</strong> spaces. Address 2 can be skipped. The Country should be a 2 character ISO-3166-1 code and will default to your default country if not set
                        array address For the array version of an Address, the requirements for Address 2 and Country are the same as with the string version. Then simply pass us an array with the keys <strong>addr1</strong>, <strong>addr2</strong>, <strong>city</strong>, <strong>state</strong>, <strong>zip</strong>, <strong>country</strong> and appropriate values for each

                        string date use YYYY-MM-DD to be safe. Generally, though, anything strtotime() understands we'll understand - <a href="http://us2.php.net/strtotime" target="_blank">http://us2.php.net/strtotime</a>
                        string dropdown can be a normal string - we <em>will</em> validate that the value is a valid option
                        string image must be a valid, existing url. we <em>will</em> check its existence
                        string multi_choice can be a normal string - we <em>will</em> validate that the value is a valid option
                        double number pass in a valid number - anything else will turn in to zero (0). Note, this will be rounded to 2 decimal places
                        string phone If your account has the US Phone numbers option set, this <em>must</em> be in the form of NPA-NXX-LINE (404-555-1212). If not, we assume an International number and will simply set the field with what ever number is passed in.
                        string website This is a standard string, but we <em>will</em> verify that it looks like a valid URL

【问题讨论】:

    标签: php mailchimp


    【解决方案1】:

    在您的列表设置中,您会找到“列表字段和 *|MERGE|* 标签”。你可以在这里添加任何你想要的!

    您还可以通过 api 以编程方式添加“合并变量”:

    • listMergeVarAdd
    • listMergeVarDel
    • listMergeVarUpdate

    当您通过 listSubscribe 在此列表中添加用户时,只需像使用 FNAME 一样使用合并变量

    $merge_vars = array(
         'FNAME' => $fname,
         'LNAME' => $lname,
         'PHONE' => '010203040506',
         'OTHERCUSTOM' => 'custom field'
    );
    

    如果您需要更新用户信息,只需将 update_existing 标志设置为 true。

    【讨论】:

    • 这很有帮助,我在 mailchimp API google 组中找不到。
    • 添加到@Emmanuel Tabard 的答案,您可以通过登录您的 MailChimp 帐户找到 OTHERCUSTOM 合并标签,然后转到 Lists->Your List->Settings->List fields 和 |MERGE| 标签。然后,您可以重命名任何自定义字段以使用您想要的任何合并标签键。
    • 如果我想简单地删除一个字段的值怎么办?
    猜你喜欢
    • 2014-11-08
    • 2021-06-03
    • 1970-01-01
    • 1970-01-01
    • 2017-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多