Sendgrid Subscription Widget Wordpress

Posted on Aug 17, 2018

Share

If you have a Wordpress site and Sendgrid is your Email Service Provider(ESP), there is a powerful tool that can integrate both systems. SG Widget is a Sendgrid Subscription Widget designed for Wordpress that allows you to place an opt-in form on your website to capture email addresses from users.


It’s super easy to install and provides a variety of useful features that make collecting emails on your Wordpress site a breeze.

Contents

SG Widget Background

SG Widget was borne out of necessity and frustration suffered by the engineers of Leader Internet. We build a lot of sites for ourselves and clients with Sendgrid often being the ESP of choice.

Sendgrid previously offered a widget in their Legacy Newsletter tool and for a long time, our developers had the luxury of dropping this into the source code of a Wordpress site. This saved us time and our client's money as weren't having to build opt-in functionality every time.

Unfortunately the Legacy Newsletter Widget was retired and no replacement was offered. We waited for an official solution from Sendgrid but with none on the horizon we took things into our hands and built our own.

The first draft was a direct replacement for the for Sendgrid version with the same functionality. Since then, we’ve added more features and made it easier to use with the result that SG Widget is now the best Sendgrid Subscription Widget on the market.

What can SG Widget do?

The purpose of SG Widget is to collect email addresses on a Wordpress site. Call it what you like, opt-in form, lead capture form, newsletter subscription tool. It generates a snippet of HTML that is dropped into your Wordpress via a shortcode and then displayed anywhere you call the shortcode. When a page loads, users will see a form to enter their email address and click submit.

It also provides the following features:

Along with fully customizable text and CSS, it has detailed documentation to explain everything from creating an account to generating a widget and installing it on a Wordpress site. Installation doesn’t require any core Wordpress changes so it’s simple and safe to add.

These are just the current features. We are continually adding new functionality and improvements based on our requirements and user feedback.

Give It A Try

Here is a live widget for you to test out for yourself:


User Review

The owner of startupsesame.com had this to say about it:

Finally got the perfect solution to integrate SendGrid on our Wordpress. Fast and seamless integration, and the best customer support you can think of.

Is This A Plugin?

No. SG Widget is not a plugin. In fact, we dislike the idea of plugins and did everything we could to make sure it is not regarded that way.

It’s an external service that generates a piece of HTML, which you add to your Wordpress site through a shortcode. The snippet contains a link to a Javascript file that sends requests to our servers where all of the processing is done.

There is nothing to install on your Wordpress - no plugins, PHP updates or core changes. It’s literally just a matter of dropping a snippet of HTML into a shortcode. This is a lot easier than plugins that provide the same functionality but require the installation of other plugins or PHP modules, which introduce risk and amplify the complexity of a task for a very simple piece of functionality. This may not be an issue on small blogs but if you are supporting client websites or enterprise domains, risk is the number one thing you need to reduce and SG Widget offers this option.

Of course, the added benefit is that because there is nothing to install in the beginning, there is nothing to support or maintain in the future. All updates and security patches are applied by SG Widget on our end without anything needing to change on your site. This means you can upgrade your Wordpress version without worrying about the compatibility of SG Widget and as all Wordpress Developers know, upgrading can be an error-prone task.

With SG Widget, you can add a Sendgrid subscription Widget to your Wordpress but avoid adding yet another plugin and all of the issues that come with it.

What about the Sendgrid Subscription Widget Wordpress Plugin?

Before we go any further, you may have noticed the Sendgrid Wordpress Plugin and are wondering what is different between that and SG Widget.

We previously used the Sendgrid Wordpress Plugin on some websites so have deep insight into the pro’s and con’s it offers. Here is a side by side comparison of both:

Wordpress Plugin
  • Doesn’t work below PHP 5.6 or above 7.1
  • Requires swift mailer plugin
  • Won't work if another plugin declares wp_mail() function
  • Stores API key in plain text
  • Only works on Wordpress
  • Widget can only be placed in certain areas
  • All processing done on your server
  • Requires fresh install on every WP site
Good for: Bloggers, hobbyists
SG Widget
  • Nothing to install
  • Works on all versions of Wordpress and PHP
  • Stores encrypted API key
  • Can be used on non wordpress sites
  • Widget can be placed anywhere on site
  • Consent checkbox feature
  • Processing done on SG Widget servers
Good For: Agencies, multi-site owners

As you can see both perform the core task of collecting emails and storing them in Sendgrid but SG Widget is easier to install(just trying to enter an API without the page reloading in the Wordpress Plugin was difficult), doesn’t require updates, is more secure and offers more features.

The SG Widget model also has an added benefit for agencies or anyone with multiple sites because updates are applied and rolled out automatically by us on our end. On the other hand, if the Sendgrid Wordpress Plugin releases a new version, it would have to be updated multiple times across any site it is installed.

How to Add The Sendgrid Widget To Wordpress

Now that you know what SG Widget is and how it is a better option than the Sendgrid Plugin for Wordpress the next thing is to get it running on your site.

  • Create an SG Widget account
  • Generate Your Widget
  • Copy the code

  • Go to your Wordpress codebase
  • Open the functions.php file, located at www.yourwebsite.com/wp-content/themes/yourtheme/.
  • Create a shortcode
  • Paste the snippet from SG Widget into the shortcode:

wordpress-shortcode.png

  • Upload functions.php to your server
  • Login into your Wordpress Admin panel
  • Call the shortcode wherever you want it to display:

wordpress-shortcode-admin.png

For more detailed instructions with screenshots, check out our docs

That’s it. Most likely you will never have to touch this shortcode again because we handle all updates and fixes on our end.

However, If you make changes to the widget instance from the SG Widget backend, these may alter the HTML of your snippet. For example, if you didn’t have the consent checkbox initially and decide to turn it on at a later date, the HTML of your widget would change and you would have to copy the newly generated snippet into the shortcode. If this happens, you will see a message when you click Update inside SG Widget that tells you whether a new version of code was generated.

Our docs have more detailed instructions on updates if you want to check them out.

Watch

For reference, here is a video that shows just how quick and easy it is add our Sendgrid Widget To Wordpress. This clip is less than 60 seconds!

Which Wordpress Versions Are Supported

All versions. SG Widget is not a plugin added to the Wordpress core so it doesn’t care or depend on Wordpress features. You just have to drop a tiny snippet of HTML into a shortcode and then all processing is done by us on our servers.

Are Wordpress Core Changes Needed?

No. There are no changes needed to the Wordpress core as the snippet is added to functions.php within your theme folder. You will simply add the snippet to a shortcode and call this shortcode from whatever posts and pages you want it to display on.

Is It Secure

Yes. In fact, it is more secure than plugins that offer opt-in functionality because SG Widget is not a plugin so there is no PHP code installed on your site.

Plugins are a notorious attack vector for hackers because they offer a backdoor into the system. There are countless examples of plugins that purposely inject malicious code into a site for the benefit of the author like carousels adding a backlink to the author's website to improve their SEO. Even plugins designed with good intentions may cause problems if they have a security vulnerability that is identified because it can be exploited rapidly on any site the plugin is installed.

More specifically, SG Widget offers greater security than the Sendgrid Wordpress Plugin because your API key is stored in encrypted form so if anyone ever obtained it, there is nothing that can be done unless they know how to decrypt it. The same cannot be said for the Sendgrid Wordpress Plugin because it stores API keys unencrypted so if anyone ever gained access to your database or obtained the API key, they would have full access to send emails from your Sendgrid account.

We have a full article dedicated to SG Widget Security so you can see the steps we take to keep things safe.

Conclusion

SG Widget is an excellent choice for anyone that wants to add a Sendgrid Subscription Widget to Wordpress. It is easy to install, secure, customizable, updates automatically and has more features than Sendgrid Wordpress Plugins. It is also ideal for agencies that want a central place to control all of the opt-in widgets across each of their sites.


Email continues to be one of the most effective marketing channels because it is direct to the user's inbox. If you are using Sendgrid and Wordpress, you can’t afford not to have an opt-in form. Give SG Widget a try today and let us know how it goes.

Comments


Jake 01.09.2019

Thanks for this. I really like how I don't have to install another plugin and can insert in the HTML in my pages. So lightweight and easy!

Carmen 07.04.2020

Can I use it in any template?

SG Widget HQ 07.04.2020

Hey Carmen. YES, SG Widget can be used in any Wordpress template without having to customise the core. Feel free to get in touch with our support if you would like to know more.

Leave a Comment: