How to Sell Ads with Gravity Forms
We’ve often been asked if AdSanity offers e-commerce functionality so that potential advertisers can sign up directly for an ad placement. We’ve always kept this sort of functionality out of AdSanity since it’s not a feature that everyone would use, and it’s certainly not a feature that everyone would use in the same way. We’ve even heard of crafty ways that our users come up with using other plugins to handle the purchasing process. We’re going to show a possible solution using one of the most popular form plugins, Gravity Forms. We’ll be able to create a quick cart so you can sell ads with Gravity Forms.
Collecting The Pieces
Before we get started there are a few plugins that you’ll need to make this work. Be sure to upload, install, and a activate all of these plugin before you move on.
- AdSanity Core
- Gravity Forms Developer License
- Gravity Forms PayPal Payments Standard add-on
- Gravity Forms + Custom Post Types
Creating The Form
The first step in building a way for your advertisers to pay for an ad placement is to build out a form using Gravity Forms. Your form may contain additional information you require from your advertisers, but I’ll just build a form with the basics. You’ll need the following fields:
Post Fields
- Post Title – Allows the advertiser to specify the name for the ad and allows you to configure how the post will get created. Under the options for this field, you’ll want to select “AdSanity: Ads” under the Post Type field. You can optionally set each submission as a draft if you’d like to review each ad before having it go live on your site. This may cause an extra step, but is valuable if you think your competitors might try to post an ad on your site. Be sure to set this field as required.
- Post Image – Allows the advertiser to upload their banner artwork. Make sure to tick the checkbox next to “Set as Featured Image” and make this field required.
- Custom Field – Allows the selected product option to populate the ad size. You’ll set this field type as “Single line text” and choose “new” under Custom Field Name. In the field below that, enter “_size”. Tick the box next to “Create content template” and insert the value of Option pricing form field for size. Under the advanced tab, set the visibility to hidden.
- Custom Field – Allows the advertiser to specify the URL they want the Ad to click through to. Set this field up as a website field type.
Pricing Fields
- Product – This will hold the total product cost of the purchase based on the size option selected by the user. Be sure to set the field type to hidden.
- Option – This will allow the advertiser to select the ad unit size they want to purchase. Choose “Drop Down” from the field type. In the choices section, fill out the Label, Value, and Price fields with the size of ads that you want to offer your advertisers. For example, if you want to offer 300×250 ads, you can put “300×250 – Medium Rectangle” for the label, “300×250” for the value, and whatever you’d like for the pricing. Make sure that this field is required.
- Total – This displays the cost to the advertiser. No additional configurations are necessary.
These are the minimum required fields to create an ad, but you might find it important to be able to communicate with your advertisers from time to time, so adding additional fields such as name and email might be helpful. Once you’re done configuring all of your fields, save your form.
Configuring Gravity Forms To Talk To PayPal
In order for Gravity Forms and PayPal to be able to communicate, you have to turn on some options in PayPal. Navigate to the Gravity Forms settings page in your dashboard. Click the PayPal tab and follow the directions to enable communication between Gravity Forms and PayPal. It’s important to note that the links to PayPal in the Gravity Forms settings area only work if you’re already logged in to PayPal.
Once this is configured navigate back to the form we just created. Under the settings link for this form, you’ll see a PayPal option. Create a new PayPal feed with the following settings:
- Your PayPal Email Address
- Production Mode
- Transaction Type set to Products and Services
- Payment amount set to the Form Total
- Check the Checkbox next to “Create post only when payment is received.”
Now your form is ready to process payment with PayPal whenever someone submits an ad. Once the payment is processed, a new Ad will be created and set as Draft for you to review. An email notice will be automatically be sent to your advertiser as well as to you, letting you know of the new submission.
The last step to getting this to work is to create a page where you describe your advertising opportunities and embed the Gravity Form for your users to interact with. This page should be linked to wherever your advertisers might look for it, potentially in your navigation or in your footer. Another good option as you’re starting out is to create an “advertise with us” ad in AdSanity and link to this page. You can then include this ad in your rotations to attract new advertisers and visually show advertisers where their ads will be placed.