In this guide, you will learn how to use the URL Parameters WordPress plugin. This powerful tool allows you to access URL parameters and display conditional content based on the Query String of the URL. This can be especially useful for tracking referral sources, personalizing user experiences, and dynamically managing content based on URL parameters.
URL parameters are essential for capturing additional insights about how and where your website traffic is coming from. They can help you:
First, let’s get the plugin installed on your WordPress site.
URL Parameters
plugin and upload the url-parameters
folder to the /wp-content/plugins/
directory of your WordPress installation.The URL Parameters plugin provides two shortcodes: [url_query]
and [if_url_query]
.
The [url_query]
shortcode is used to display the value of a URL parameter. This is perfect for dynamically inserting campaign-specific information into your content.
Suppose you want to greet users based on their city. You can use the following shortcode:
[url_query param="city" default="Cleveland"]
https://yourwebsite.com/?city=New-York
New York
If the city
parameter is not set, it will default to “Cleveland.”
The [if_url_query]
shortcode allows you to conditionally display content based on the value of a URL parameter. This can be used to tailor messages or offers to specific campaign sources or user segments.
You have a summer campaign, and you want to display a special message only if the user comes from this campaign.
[if_url_query param="utm_campaign" is="summer"]Welcome to our Summer Campaign![/if_url_query]
https://yourwebsite.com/?utm_campaign=summer
Welcome to our Summer Campaign!
If the utm_campaign
parameter is not "summer"
nothing will be displayed.
You can also use the [if_url_query]
shortcode to display content if a parameter is empty or not set.
Example Usage:
Welcome visitors who haven’t specified their name in the URL.
[if_url_query param="FirstName" empty="1"]Welcome to the site, visitor![/if_url_query]
https://yourwebsite.com/
Welcome to the site, visitor!
If the FirstName
parameter is set, this message will not be displayed.
You can specify multiple parameters separated by commas. The plugin will check for each parameter in order until a matching one is found and return that. If no parameters match, the default will be returned.
[url_query param="FirstName,first,name" default="Friend"]
https://yourwebsite.com/?name=John
John
If none of the parameters are set, it will default to “Friend.”
Use the plugin to personalize landing pages based on URL parameters from your marketing campaigns. For example, dynamically display the product name, discount offer, or personalized greeting based on campaign parameters.
[url_query param="product" default="our latest product"]
https://yourwebsite.com/?product=SuperWidget
SuperWidget
Show a tailored message or offer based on the referral source of your visitors.
[if_url_query param="utm_source" is="google"]Thanks for visiting us from Google![/if_url_query]
The URL Parameters plugin is a versatile tool that can significantly enhance your marketing campaigns by enabling personalized and dynamic content based on URL parameters. Whether you are tracking referral sources, personalizing user experiences, or creating dynamic landing pages, this plugin has you covered.
If you have any questions or need further assistance, please feel free to reach out to our support team.
Happy marketing!