Configuring subscribes and unsubscribes

This topic is for administrators and developers with administration access rights in Magento 2.

This topic describes how to configure the newsletter subscription and unsubscription feature, if you are using Magento 2 as e-commerce platform with Optimizely Campaign. It also shows how to transfer other recipient data to Optimizely Campaign, data that is not included in the standard configuration of the Magento 2 integration.

To configure subscribes and unsubscribes, do the following:

  1. Configure the opt-in mailing (registration confirmations) in Optimizely Campaign, and then use a field function to reference the confirmation link to your shop.
  2. Create two landing pages in Magento 2, one to display a successful newsletter subscription confirmation, and one to display a successful unsubscribe confirmation.
  3. Store the client ID, the authorization code for the API access, and the ID of the opt-in process the shop.
  4. Optional: Expand the recipient list structure, to transfer other recipient/customer data that is not included in the standard configuration of the Magento 2 integration.

Configuring the opt-in mailing

  1. Open the Optimizely Campaign menu and select Campaigns > Opt-in Processes.
  2. Select the opt-in process for the connection to your shop and click Edit….

    Image: Edit button

  3. On the Email node, click Properties .
  4. Click Edit Content….

    Image: Email node

  5. Click the name of the paragraph that contains the registration confirmation link.
  6. In the Text area, click Source.

    Image: View source

  7. Replace the existing link with the following code lines/field functions:
    {Double-Opt-In-Link}?id=${user.data.bmecssid}&code=${user.data.bmecsscc}

    You will find the link to be replaced in the <a> tag between the quotation marks.

    Example

    The following link is contained in the <a> tag in the source code:

    <a href="http://srv2.de/subscribe.html">Complete registration</a>

    Replace the link between the quotation marks as follows:

    <a href="{Double-Opt-In-Link}?id=${user.data.bmecssid}&code=${user.data.bmecsscc}">Complete registration</a>

    Image: Replace link

    The parameters id and code enable the Magento 2 integration to map to the data sets in your shop.

  8. Click ApplyCloseSave and close.

Creating landing pages

  1. Log in to Magento 2 with administrator rights.
  2. Select Content > Pages.

    Image: Pages

    Image: Pages 2

  3. Click Add New Page.

    Image: Add new page

  4. In the Page Title field, enter a name for the landing page.

    Image: Page Title field

    Assign unique names to the landing pages, for example Optimizely Campaign opt-in confirmation or Optimizely Campaign opt-out confirmation.

  5. Click Content.

    Image: Content link

  6. In the Content Heading box, enter the title that you want to display on the landing page.

    Image: Content Heading field

  7. In the text box, enter the text that you want to display on the landing page.

    Image: Landing page text box

  8. Optional: If required, change other settings on the form, such as layout adjustments under Design.
  9. Click Save Page.

    Image: Save Page

  10. Repeat steps 3–9 for the second landing page you want to create.

Storing authorization code, opt-in, and client IDs

Do not confuse the recipient list for your newsletter recipients with the transaction recipient list for your transactional mails. Customer support will set up two different types of recipient lists for the sending of newsletters and the sending of transactional mails (for example order confirmations, invoices).

  • Authorization code. For the Optimizely Campaign recipient list (created for you by customer support and saved in your client). You can locate the authorization code in your Optimizely Campaign client in the API overview. Open the Recipient lists tab and select the relevant recipient list. Click Manage authorization codes and copy the authorization code from the list. If no authorization code is available for the selected recipient list, click Create authorization code.
  • opt-in ID. To see the opt-in ID, open the Optimizely Campaign menu and select Administration > API overviewOpt-in processes.
  • client ID. To see the client ID, open the Optimizely Campaign menu and select Administration > API OverviewREST API.
  1. To store the parameters, log in to Magento 2 with administrator rights.
  2. Select Stores > Configuration.

    Image: Select Configuration

  3. Select Episerver > Episerver Campaign.
  4. Image: Episerver > Episerver Campaign

  5. In General Settings, enter the following data:
    • Client ID. Enter the client ID.
    • Client Name. Enter a name for the client. You can choose any name for the client. However, use the same name as in Optimizely Campaign.
    • Authorisation Code. Enter the authorization code.
    • Opt-In ID. Enter the opt-in ID.
    • Debug Mode. Select Yes.

    Image: General settings

  6. In the HTTP API area, from the Landing page for newsletter subscription confirmation drop-down list, select the landing page that you created for the newsletter registration in Magento 2.

    Image: Landing page - confirm subscription

  7. In the HTTP API area, from the Landing page for newsletter unsubscribe confirmation drop-down list, select the landing page that you created for the newsletter unsubscription in Magento 2.

    Image: Landing page - confirm unsubscription

  8. Save your changes.

    Coded values (Client ID, Private key) must be entered anew with each saving process. Otherwise the coded value is coded anew.

Transferred attributes in the standard configuration

The Magento 2 integration only transfers the email addresses of customers who subscribe to the newsletter with their email address, but are not logged into their customer account. The data listed in the following table is transferred for customers who are logged into the customer account.

If a customer or an administrator changes the customer data in the shop system, the changes are automatically transferred to the Optimizely Campaign recipient list. Changes to customer data entered in a recipient list in Optimizely Campaign are not synchronized with your shop system by Magento 2 integration. For this reason, change customer data in your Magento 2 system to keep the information synchronized.

  • Email. Email address of the customer/recipient
  • Salutation. Title
  • Firstname. First name
  • Lastname. Last name
  • Language. Language of the shop set up in Magento 2 in which the customer has registered
  • Street. Street
  • Zip. Postal code
  • City. City
  • State. State
  • Country. Country
  • bmecssid. ID generated by Magento 2 integration and used for identification during communication with Optimizely Campaign
  • bmecsscc. Confirmation code generated by Magento 2 integration and used for identification during communication with Optimizely Campaign
  • store_id. ID of the web shop in which the customer has registered
  • dob. Date of birth
  • group_id. Customer group

Expanding the recipient list structure and transferring additional recipient data

You can transfer other recipient/customer data from Magento 2 to Optimizely Campaign, in addition to the standard attributes. To set up the transfer, you need to:

  • Request additional recipient list fields.
  • Enable the additional recipient data in Magento 2.

The additional attribute fields in Magento 2 must be programmed in accordance with the specifications of Magento 2. Additional attribute fields that have not been programmed according to the Magento 2 specifications cannot be transferred to Optimizely Campaign.

Requesting additional recipient list fields

To request additional recipient list fields, contact customer support and let Optimizely know which additional recipient list fields you require for user-defined attributes. Customer support will expand your list of recipients with the additional recipient list fields as per your requirements.

Enabling the transfer of additional recipient data

After customer support adds the requested recipient list fields, activate the transfer of the corresponding recipient data via HTTP API in Magento 2.

  1. Log in to Magento 2 with administrator rights.
  2. Select Stores > Configuration.

    Image: Select Configuration

  3. Select EpiserverEpiserver Campaign.

    Image: Select Episerver > Episerver Campaign

  4. In the HTTP API area, in the Configure additional customer attributes to transmit list, select the additional recipient data that you want to transfer to Optimizely Campaign in addition to the standard attributes.

    Image: Customer attributes

    Hold down CTRL to select multiple attributes at the same time.

  5. Save your changes.