Integrate Account Engagement with WordPress: easily track visitors, embed forms and dynamic content in pages and posts, or use the forms or dynamic co …
Say hello to marketing automation simplicity! With a single login, your self-hosted WordPress installation will be securely connected with Account Engagement. With the selection of your campaign, you’ll be able to track visitors and work with forms and dynamic content without touching a single line of code. You can use the widget to place a form or dynamic content anywhere a sidebar appears, or embed them in a page or post using a shortcode or the Account Engagement button on the Visual Editor’s toolbar.
marketing-cloud-account-engagement-for-wordpress/trunk
to your /wp-content/plugins/
directory or go to Plugins > Add New in your WordPress Admin area and search for Account Engagement.In order to use Salesforce SSO authentication, you must create a connected application for the plugin in your Salesforce org.
https://[YourWordpressDomainHere]/wp-admin/options-general.php?page=pardot
.You should then see Authentication Status change from “Not Authenticated” to “Authenticated”.
Two simple shortcodes are available for use.
Form Shortcode
[pardot-form id="{Form ID}" title="{Form Name}" class="" width="100%" height="500" querystring=""]
Use [pardot-form]
with at least the id
parameter. For instance, [pardot-form id="1" title="Title"]
renders my Account Engagement form with an ID of 1.
Optional parameters:
The title
parameter is included when using the toolbar button, but it’s not required for display. There is no default.
The class
parameter allows you to add additonal classes to the iframe element. There is no default, but the class pardotform
is now automatically added, regardless of any additional classes.
The width
parameter will set the width of the iframe in pixels or percentage. For example, “500”, “500px”, and “80%” are all valid. The default is 100%.
The height
parameter will set the height of the iframe in pixels only. For example, “500” or “500px” are valid. The default is 500px.
The querystring
parameter appends an arbitrary string to the end of the form’s iframe source. This is helpful for passing data directly into the form. You can also do this with filters (see below).
Dynamic Content Shortcode
[pardot-dynamic-content id="{Dynamic Content ID}" default="{Non-JavaScript Content}"]
Use [pardot-dynamic-content]
with at least the id
parameter.
The default
parameter is used for accessibility. Whatever is placed here is wrapped in <noscript>
tags and is shown only to users who have JavaScript disabled. By default, it will automatically be your “Default Content” as designated in Account Engagement. So,
[pardot-dynamic-content id="1" default="My default content."]
would render something like:
<script type="text/javascript" src="http://go.pardot.com/dcjs/99999/99/dc.js"></script><noscript>My default content.</noscript>
…which would show the dynamic content to users with JavaScript enabled, and ‘My default content’ to users with it disabled. Note that, due to the way the WordPress Visual Editor works, HTML tags for the parameter will be URL encoded to avoid strange formatting.
Simply choose another campaign in Settings > Account Engagement Settings and click ‘Save Settings’.
Since every WordPress theme is different, embedded forms won’t always automatically fit. You’ll want to make a Account Engagement Layout Template specifically for your WordPress theme:
Edit the layout template and add the following to the <head>
section of the template:
<style type=”text/css”>
#pardot-form input.text, #pardot-form textarea {
width: 150px;
}
</style>
A width of 150px is just a starting point. Adjust this value until it fits on your page and add additional styles as you see fit. For styling help, reference our Basic CSS for Forms page.
Go to Settings > Account Engagement Settings and click ‘Reset Cache’. This should reinitialize and update your Account Engagement content.
As of version 1.4, developers can now deal with various directory configurations that would previously cause the plugin to break. This is due to the plugin not being able to find wp-load.php
.
To fix it, add a new file called pardot-custom-wp-load.php
to the plugins/pardot/includes
directory (this will never be overridden by updates). In that file, define a constant that gives the absolute path to your wp-load.php
file. For instance:
define('PARDOT_WP_LOAD', '/path/to/wp-load.php');
pardot_form_embed_code_[Form ID]
Filter the entire embed code for a given form. A common usage for this is conditionally appending a query string. So, for instance, the following will filter the embed code for form #545 and append an arbitrary parameter along with the post ID of the page being viewed:
function pardot_custom_append_querystring($body_html) { return preg_replace( '/src="([^"]+)"/', 'src="$1?this=that&postID=' . get_the_ID() . '"', $body_html ); } add_filter( 'pardot_form_embed_code_54796', 'pardot_custom_append_querystring' );
You can apply any conditional logic you want. For instance, this will append the same information, but only if you’re on the “About” page:
function pardot_custom_append_querystring($body_html) { if ( is_page('About') ) { $body_html = preg_replace( '/src="([^"]+)"/', 'src="$1?this=that&postID=' . get_the_ID() . '"', $body_html ); } return $body_html; } add_filter( 'pardot_form_embed_code_54796', 'pardot_custom_append_querystring' ); pardot_https_regex
Filter the regular expression used to find URLs to be converted to https://go.pardot.com. This is only used when “Use HTTPS?” is checked in the settings. You may want to filter this regex if you find it’s not properly capturing and converting your URLs.
function pardot_custom_filter_https_regex() { return "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,63}(\/\S[^'\"]*)?/"; } add_filter( 'pardot_https_regex', 'pardot_custom_filter_https_regex' );
_pardot_cache_keys
and _pardot_transient_keys
rows from your options table)pardot_get_setting
[100888]shortcode_exists
fatal errorhas_shortcode
fatal error<noscript>
default to Default Pardot Content