Using WordPress as a SaaS Platform with OptinMonster

32
Thomas Griffin https://thomasgriffin.io 1 Using WordPress as a SaaS Platform By: Thomas Griffin (@jthomasgriffin)

Transcript of Using WordPress as a SaaS Platform with OptinMonster

Page 1: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 1

Using WordPress as a SaaS PlatformBy: Thomas Griffin (@jthomasgriffin)

Page 2: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 2

Who am I?

Page 3: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 3

I am a partner and CTO of Awesome Motive, Inc. and the technical Co-Founder of OptinMonster. Prior to OptinMonster, I founded Soliloquy, the fastest WordPress slider plugin, and Envira Gallery, a revolutionary gallery solution for photographers. I also built TGM Plugin Activation and serve over 30,000 happy customers.

Thomas Griffin

Page 4: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 4

To improve is to change; to be perfect is to change often.

!

"

Winston Churchill

Page 5: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 5

History of OptinMonster#

Page 6: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 6

The OptinMonster Timeline

We meet to discuss the awesomeness that would become OptinMonster.

OptinMonster is Born

We failed to build a SaaS model, so we pivoted to a WordPress plugin. Totally worth it.

OptinMonster Launches

We moved from an MVP to a rock-solid v2.0 release, building a very feature-rich platform with even better technology.

OptinMonster 2.0 Lands

Our customers are demanding solutions outside of WordPress, so we hit the ground running building the hosted platform.

OptinMonster…SaaS?

Jan. 1, 2013 Sept. 24, 2013 Aug. 24, 2014 Oct. 8, 2014 May 5, 2015

The OptinMonster hosted platform launches, allowing OptinMonster to be used on any website.

OptinMonster App

Page 7: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 7

The Moving Process$

Page 8: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 8

Epic Considerations•Data Migration •Scaling •System Architecture •Security •Payments •Onboarding •Support •Caching •High Availability and Redundancy •Interfaces •User Experience •Development Workflow

Page 9: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 9

Practical Application%

Page 10: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 10

Over 7 billion requests served since 2013.

Page 11: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 11

500 million requests served last 30 days.

Page 12: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 12

5 million leads generated in last 30 days. (That’s a bunch of requests to email service providers)

Page 13: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 13

And WordPress handles all this??!?!?! YES!

Page 14: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 14

Meat and Potatoes&

Page 15: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 15

Database

•InnoDB preference over MyISAM •add index to wp_options autoload •use persistent object caching with Redis to prevent extra queries

Page 16: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 16

Users

<?php wp_*_current_user() *_user_meta()

•start with simple subscriber user, strip permissions, add caps from here

•custom data keys for account access using user meta

Page 17: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 17

Optins

•custom post type for handling each optin •custom data storage using JSON (https://thomasgriffin.io/wordpress-performance-outside-box-handling-retrieving-data/)

•custom AJAX requests for saving and generating data •public output generated at save and update intervals for performance

Page 18: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 18

API Requests

•scaling API requests (https://thomasgriffin.io/a-creative-approach-to-efficient-and-scalable-wordpress-api-endpoints/)

•this solution works for admin-ajax.php requests too! (https://gist.github.com/thomasgriffin/11b859f0531a812bb273)

Page 19: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 19

API Requests<?php /** * Plugin Name: Custom admin-ajax.php Helper * Plugin URI: https://thomasgriffin.io * Description: Whitelists the plugins to be loaded during admin-ajax.php requests for performance. * Author: Thomas Griffin * Author URI: https://thomasgriffin.io * Version: 1.0.0 */ !// Check against the request URI. if ( ! isset( $_SERVER['REQUEST_URI'] ) ) { return; } !// If it does not match the admin-ajax.php route, do nothing. if ( strpos( stripslashes( $_SERVER['REQUEST_URI'] ), 'admin-ajax.php' ) === false ) { return; } !// Ok, this is an admin-ajax.php request. Filter available plugins. add_filter( 'pre_option_active_plugins', 'tgm_whitelist_admin_ajax_plugins' ); function tgm_whitelist_admin_ajax_plugins( $plugins ) { ! // Only modify the ajax requests performed by our own plugin. $action = isset( $_REQUEST['action'] ) ? stripslashes( $_REQUEST['action'] ) : false; if ( ! $action ) { return $plugins; } ! // For this example, we will target the heartbeat ajax request. if ( 'heartbeat' !== $action ) { return $plugins; } ! // Prevent any plugins from loading during the request. $whitelist = array( // my-custom-plugin/my-custom-plugin.php ); ! // Return the whitelist instead of the default plugins. return $whitelist; !}

Page 20: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 20

Caching

•literally cache everything with persistent object cache (preferably Redis) and fastcgi cache with Nginx

•this makes 99.9% of requests hit cache •minimize impact of non-cache hits to DB

Page 21: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 21

Infrastructure

•we love Pagely! •custom setup on AWS using ec2 load balanced instances, RDS (database), Route 53 for DNS, Elasticache w/ Redis

•smart cache purge policy on updates and save requests •utilize MaxCDN for images and API script requests

Page 22: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 22

Development Flow

•absolutely everything starts on local! •marketing and app site split into two separate installs •staging and production environments •git feature branch dev - (http://nvie.com/posts/a-successful-git-branching-model/)

•custom vagrant boxes for easy dev on boarding

Page 23: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 23

Support

•all requests through HelpScout - easy ticket sharing, notes, workflows •integrated with Gravity Forms to automatically tag and segment requests

•TONS OF DOCUMENTATION •fuzzy search and user “creates docs for us” •happiness reports to identify trends, ways to improve

Page 24: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 24

Support

Page 25: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 25

Notifications

•simple notification system for in-app updates •custom post type and user meta to check for view state •pulsing dot to notify users of new notifications

Page 26: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 26

Jobs and Queues

•daemons and workers to handle intensive, long processes •utilize redis + job queues to prevent server overload •useful for monthly conversion reports, platform data insights

Page 27: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 27

But the most important ingredient…

Page 28: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 28

YOUR TEAM!'

Page 29: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 29

Processes and systems help, but your team makes the difference.

Page 30: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 30

So WordPress…Worth It?⋆

Page 31: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 31

Page 32: Using WordPress as a SaaS Platform with OptinMonster

Thomas Griffin https://thomasgriffin.io 32

That’s all, folks!