Using Exit Intent with DailyStory and WordPress

A couple of days ago I wrote about 3 best practices for exit intent. Exit intent is something that is built-in to DailyStory as part of the digital marketers toolkit we include.

Adding exit intent to your website with DailyStory is super simple

Once the DailyStory tracking code is installed, exit intent is automatically available. All you need to do is identify the pages you want to display it on.

Below is an exit intent I created for www.dailystory.com to encourage visitors to sign up for our newsletter (this is the exit intent designer in the DailyStory application):

DailyStory exit intent

When visitors interact with this exit intent it can populate a new lead in a campaign (in this case it adds leads to the ‘Newsletter’ campaign). The Newsletter campaign sends a thank you email and then adds you to our MailChimp newsletter.

This exit intent is currently setup for our very first blog post. If dismissed you won’t see this exit intent on this page, or within the entire site, for 1 month.

Don’t forget the Analytics

Ever wonder how your exit intent is performing? Analysis is a fundamental part of everything that happens when you use DailyStory:

Exit intent analytics

What’s not shown is a list of converted leads. These leads can be managed directly within DailyStory or you can push them to your CRM, such as Salesforce.

Using the JavaScript API

Another approach is to use the DailyStory JavaScript API to push exit intent when certain conditions are met. The DailyStory JavaScript API is available for developers wherever the tracking code is installed.

While the tracking code can do some auto-magic automagically, sometimes you want to write code (and we’re all about writing code).

For example, you can listen for the event raised when the async JavaScript and JSON are loaded. Next, you can use the DailyStory JavaScript API:

window.addEventListener('ds_popup_ready', function (e) {
		Ds.Pop.showPopupOnExit('29');
});

A sample use of this is our DailyStory WordPress plugin:

public static function dailystory_exit_intent_shortcode($atts, $content=null) {
		// normalize attribute keys, lowercase
		$atts = array_change_key_case((array)$atts, CASE_LOWER);

		// override default attributes with user attributes
		$popup_id = shortcode_atts(['id' => '0',], $atts, $tag);

		$popup_id = esc_html__($popup_id['id'], 'ds-exitintent');

		add_action('wp_footer', function ( $content ) use ($popup_id) {
		echo '<!-- Added by WordPress shortcode -->' . "\n";
		echo '<script type=\'text/javascript\'>' . "\n";
		echo 'window.addEventListener(\'ds_popup_ready\', function (e) {' . "\n";
		echo '	Ds.Pop.showPopupOnExit('. $popup_id . ');' . "\n";
		echo '});' . "\n";
		echo '</script>' . "\n";
		});
}

Using this plugin within a post is simple: when you want to force an exit intent popup within WordPress you just add the following to any post or page:

[ds-exitintent id="29"]

More to come!