Connect for Acoustic (Silverpop)
The Acoustic add-on connects Acoustic (Silverpop) with Optimizely Forms, letting marketers collect visitor data, and pass that on to be used with Silverpop.
The Optimizely Connect for Acoustic (formerly Watson Marketing, formerly Silverpop) add-on is part of Optimizely Connect for Marketing Automation.
Prerequisites
An Optimizely Content Management System (CMS) installation with Optimizely Forms and the required Marketing Automation connector components.
Install
Install the Connect for Acoustic (Silverpop) MA connector through the NuGet package EPiServer.MarketingAutomationIntegration.Silverpop. See Add-ons platform compatibility for supported Optimizely versions.
Configure
To configure your Optimizely website to use Acoustic (Silverpop), you need an Acoustic (Silverpop) license that provides you with a username, password, and company name. You also need to configure the connection of form fields to Acoustic (Silverpop), so that data from the specified fields can be sent to Acoustic (Silverpop).
These configurations are described in Acoustic (Silverpop) connector (CMS 11).
Encrypt credentials
Credentials are encrypted and saved based on one of the following options:
MAICryptoKey
(AES encryption with a SHA256-computer hash based on the value of the key)machineKey
of the server inweb.config
.
Note
For DXP instances, use
MAICryptoKey
.
If you choose to use machineKey
configuration, you should specify a machineKey
in the web.config
of your site so that when you deploy it to a different server, the same machine key is used on the new server.
Note
If you neglect to specify a
machineKey
in theweb.config
, the credentials are removed when the site on the new server is accessed for the first time, in which case you need to save credentials again through the configuration screen.
If the credentials are already encrypted using machineKey
in an existing site, and you add the MAICryptoKey
setting, then the credentials are deleted, and you must re-enter them.
Similarly, if the encryption uses MAICryptoKey
first and then you decide to use machineKey
encryption (by deleting the MAICryptoKey
setting), then the credentials are deleted and must be re-entered.
Customizing Acoustic
This section describes how to customize mailing templates when using the Optimizely Connect for Acoustic (Silverpop) add-on.
Acoustic (Silverpop) provides the base class SilverpopMailingPageBase to create a mailing template, which contains all required properties. You can add custom properties to construct a mailing template by inheriting it.
The following code samples apply to a web form on the Optimizely Content Management System (CMS) "Alloy" sample site.
-
Create the content type page as follows:
using EPiServer.Core; using EPiServer.DataAbstraction; using EPiServer.DataAnnotations; using EPiServer.MarketingAutomationIntegration.Core; using EPiServer.MarketingAutomationIntegration.Silverpop.Enums; using EPiServer.MarketingAutomationIntegration.Silverpop.Implementation; using EPiServer.MarketingAutomationIntegration.Silverpop.UI.PageTypes; using System.ComponentModel.DataAnnotations; namespace EPiServer.Templates.Alloy.Models.Pages { [ContentType(GroupName = "Connect For Marketing Automation")] [ImageUrlAttribute("~/Static/gfx/SilverpopMailingPage_Preview.png")] public class MySilverpopMailingPage: SilverpopMailingPage { [BackingType(typeof (PropertyString))] [Display(GroupName = EPiServer.MarketingAutomationIntegration.Constants.MAIPageTypeTabs, Order = 40)] public virtual string MyCustomProperty { get; set; } } }
-
Create the template file with the following markup:
<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeBehind="SilverpopMailingPageTemplate.aspx.cs" Inherits="EPiServer.Templates.Alloy.Views.Pages.SilverpopMailingPageTemplate" %> <!DOCTYPE html> <html lang="en"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width" /> <!-- For injecting script resource into Mailing template page at header --> <EPiServer:RequiredClientResources RenderingArea="Header" ID="RequiredResourcesHeader" runat="server" /> </head> <body> <EPiServer:Property runat="server" PropertyName="MyCustomProperty" /> <form runat="server"> <EPiServer:Property runat="server" PropertyName="HTMLBody" /> </form> <!-- For injecting script resource into Mailing template page at footer --> <EPiServer:RequiredClientResources RenderingArea="Footer" ID="RequiredResourcesFooter" runat="server" /> </body> </html>
In code behind it should look as follows:
using EPiServer.Framework.DataAnnotations; using EPiServer.Templates.Alloy.Models.Pages; namespace EPiServer.Templates.Alloy.Views.Pages { [TemplateDescriptor(Path = "~/Views/Pages/SilverpopMailingPageTemplate.aspx")] public partial class SilverpopMailingPageTemplate: TemplatePage < SilverpopMailingPage > {} }
-
Compile and run your project.
Customize opt-in/opt-out functionality
You can develop opt-in and opt-out functionality for the mailings with the Optimizely Connect for Marketing Automation add-on.
The following web forms page works with the Acoustic (Silverpop) provider API and shows how you can opt in, opt out, or check the status of the current user of the marketing automation add-on.
using System;
using System.Collections.Generic;
using System.Web.UI;
using EPiServer.MarketingAutomationIntegration.Caching;
using EPiServer.MarketingAutomationIntegration.Core;
using EPiServer.MarketingAutomationIntegration.Services;
using EPiServer.MarketingAutomationIntegration.Silverpop.APIs.XMLResultModel;
using EPiServer.MarketingAutomationIntegration.Silverpop.Domain;
using EPiServer.MarketingAutomationIntegration.Silverpop.Implementation;
using EPiServer.MarketingAutomationIntegration.Silverpop.Services;
using EPiServer.ServiceLocation;
namespace Samples {
public partial class OptInOptOutSamples: Page {
private SilverpopProvider _provider = WorkingContext.Current.ActiveProvider as SilverpopProvider;
private ContactService _contactService = ServiceLocator.Current.GetInstance < IProfileService > () as ContactService;
private ICacheService _cacheService = ServiceLocator.Current.GetInstance < ICacheService > ();
protected void OptOut_Click(object sender, EventArgs e) {
// opt out current contact
var contact = _contactService.GetCurrentProfile() as Contact;
if (contact == null) {
lblOptOutResult.Text = "Cannot get current visitor! You must create visitor first by submit a XForm to Silverpop!";
return;
}
// need to specify recipient id to opt out exactly 1 contact in non email key database
var response = _contactService.OptOutRecipient(contact.DatabaseId, contact.Id);
if (response.WasSuccessful) {
lblOptOutResult.Text = "Opted out current visitor successfully!";
return;
}
lblOptOutResult.Text = "Failed to opt out current visitor, error: " + response.Fault.FaultString;
}
protected void OptIn_Click(object sender, EventArgs e) {
var contact = _contactService.GetCurrentProfile() as Contact;
if (contact == null) {
lblOptInResult.Text = "Cannot get current visitor! You must create visitor first by submit a XForm to Silverpop!";
return;
}
var response = _contactService.AddRecipientNonKeyed(
contact.DatabaseId,
contact.VisitorKey.Value.ToString(),
new List < Column > ());
if (response.WasSuccessful) {
lblOptInResult.Text = "Opted in current visitor successfully!";
return;
}
lblOptInResult.Text = "Failed to opt in current visitor, error: " + response.Fault.FaultString;
}
protected void Show_Status_Click(object sender, EventArgs e) {
var contact = _contactService.GetCurrentProfile() as Contact;
if (contact == null) {
lblStatusResult.Text = "Cannot get current visitor! You must create visitor first by submit a XForm to Silverpop!";
return;
}
var selectRecipientResponse = _contactService.SelectRecipientData(contact.Id, true, contact.DatabaseId);
if (string.IsNullOrEmpty(selectRecipientResponse.OptedOut)) {
lblStatusResult.Text = "Current visitor is opted in";
} else {
lblStatusResult.Text = string.Format("Current visitor is opted out at: {0}", selectRecipientResponse.OptedOut);
}
}
}
}
Related blog post: Create multiple instances of the same connector by Jason Masterson
Updated 6 months ago