Support Center

Wordpress Integration

Last Updated: Feb 11, 2015 10:54AM MST

Using Wordpress to host your landing page?

PurlHub integrates with any CMS system including Wordpress, Joomla, Drupal, and or custom.  All that is required for integration into any web page or host, is inserting our JavaScript initialization code into the HTML.  URL rewriting is all that is necessary to create clean URL's for your campaign landing page.  The URL rewriting principles outlined below can be applied to any CMS or website.

In this guide, we'll be setting up a PATH based pURL landing page hosted in Wordpress.  We'll assume that you've already installed and deployed Wordpress and are ready to begin setting up pURL integration.

(1) As usual, the first step is to Include the purlHub JavaScript and initialization code in the HTML HEAD section of your wordpress site.  Start by locating your wordpress "Theme" directory - usually located within the directory "wp-content/themes/" of your wordpress installation.  With your preferred text editor, open the file named header.php and insert, just before the closing </HEAD> tag, the HEAD section code from the "landing page integration" of your chosen purlHub Campaign.  Your final edit should look something like the following:



(2) If you are using QR codes or email only; to distribute your pURLs, then this step is purely discretionary.  Your entire Wordpress site is now ready for HTML personalization and capable of receiving pURL visits in Query String format at any page in your Wordpress site.  (I.E. http://www.my-wordpress-site.com/hello-world/?_purl=JohnSmithX2)

If you expect or require visitors to enter the landing page address by hand, or simply prefer a cleaner URL - you'll need to add a rewrite configuration to support your permalink or WP URL of choice.  To prevent conflicts with other Wordpress pages, first choose a virtual directory name that does NOT already exist as a permalink or post in Wordpress.  We'll use directory /demo/ for this example, so our campaign URLs will look like:


 Note: It is not necessary that the directory /demo/ exists in your Wordpress installation, and to avoid any potential conflict ensure that it doesn't exist before continuing.

Then we'll need to select a wordpress page permalink to be our default "landing page" for all purls in this campaign; i.e. the page each purl visitor will see when they enter their personalized URL in their browser address bar, or click on a link in their personalized email message.   For this example, we'll use the Wordpress page named "welcome-page".

At this point, you can choose a Wordpress rewrite method that works best for your situation.  If you are using a recent version of Wordpress, use Method #1 compatible with most typical Wordpress installations.  If you're an IT professional or you are using an older version of Wordpress (earlier than 3.1), and using the Apache HTTP Server, Method #2 using Apache's mod_rewrite and mod_proxy may be preferable. 


Method #1 (Wordpress plugin)


  • Wordpress 3.x or greater.
  • Ability to install Wordpress plugins.
  • Wordpress rewrire plugin version 0.2.1 or greater.
The first step is to install and activate the Wordpress rewrite plugin if its not already installed. https://wordpress.org/plugins/rewrite/ 

Once installed and activated, use the plugin to backup your current Wordpress rewrite rules, in case you should need to restore them later.  

Next, check your permalink structure.  The following rewrite configuration is tested against permalink settings "Post name" or "Custom Structure" set to "/%postname%" or similar.  However, if you know what you are doing any option could be made to work.

Then add a rewrite configuration for your pURL landing page slug.   
  1. On the Rewrite plugin, click add Rule.
  2. In the Rule Pattern field add "demo/([^/]*)/?(\?.*)?$"
    (replace the word demo with your chosen virtual directory name)
  3. In the Match field enter "index.php?pagename=welcome-page&$matches[2]"
    (replace the welcome-page with your chosen wordpress page slug)
  4. Save the rewrite configuration by clicking Save and Flush Rules.
  5. Lastly, test and reorder the rules by entering "http://www.example.com/demo/JohnSmithX2" in the "Test" field above the list.  Locate the new rule you just entered and move it to the top of stack by clicking and dragging from the Reorder column on the right.  Then click Save & Flush Rules to apply the change.  

As long as you have a matching Access Control rule in your purlHub campaign, you should now be able to view personalized URLS like  http://www.example.com/demo/ClaytonSlawsonUq


Method #2 (Apache)


  • Apache 2.x or greater.
  • Apache mod_rewrite enabled.
  • Apache mod_proxy enabled.

Locate the file named ".htaccess" in the root of your wordpress installation. Open it with your text editor of choice and add the following line immediately below the "RewriteBase" directive.

   RewriteRule ^demo/.* /welcome-page/ [P,L]

The edited file resemble the following: 

At this point, http://www.my-wordpress-site.com/demo/JohnSmithX2 should display the wordpress page http://www.my-wordpress-site.com/welcome-page/


(3) Finally,  add some personalization to your site by editing your pages adding purlHub tagged elements.  Start with the landing page "/welcome-page/", of course.  Keep in mind any secondary page navigation by you pURL visitors can be personalized also.   

Start by adding a First Name & Last Name greeting.

Add personalization tags on as many pages as you like.  That's purlHub integration on a Wordpress site.   

Contact Us

  • Post a Public Question
  • Ask the Community
  • Email Us

Recent Discussions