Learn how to set up and insert dynamic coupon codes with Dotdigital and Magento 2.
Using coupon codes generated by an external dynamic content URL lets you include unique, single-use coupon codes within your email campaigns. It’s a great way to incentivise your contacts with coupon codes without the risk of the codes being shared and abused.
Sending campaigns with dynamic content coupon codes
We'd advise that you consider using send throttling for campaigns containing a dynamic coupon code. This will help to prevent performance issues with your site related to a large number of simultaneous requests to your servers.
If you're planning to send the campaign through an automated program which is likely to have large numbers of contacts enrolling at one time, you may want to consider using quantity splits and delay nodes to stagger the sends. To learn more, check out the articles Use quantity splits in programs and Add a delay node to a program.
1. Set up Cart price rules
First you need to set up cart price rules for your coupon code:
- In Magento 2, go to Marketing > Promotions > Cart Price Rules, then select Add New Rule.
- Under Rule information, enter a Rule name and Description for your rule.
- Switch the Active toggle to Yes.
- For Websites, choose the websites you want this code to be valid on.
- For Customer Groups, choose the customer groups you want to be able to use this code.
- Expand the Coupon drop-down menu, then select Specific Coupon.
- For Coupon code, select the Use Auto Generation checkbox.
- For Uses per Coupon and Uses per Customer, enter 1.
- If you have a promotion with a specific end date, choose a From and To date for your code.
If you want the code to expire after so many days, leave this blank, and we can set an expiry later.
- Select Save and Continue Edit.
2. Generate a Dotdigital Coupon URL
In this step, you generate your coupon code URL to use in your campaign as external dynamic content. You must generate your Coupon code URL in one step. Saving at this point won't save any of your details.
To generate a coupon code URL:
- Under Cart price rules, select the rule you created in Step 1.
- Expand the Dotdigital Coupon URL Builder settings menu.
- Expand the Code Format drop-down menu, then choose Alphanumeric, Alphabetical, or Numeric.
- If you want, enter a Code Prefix or Code Suffix.
- If you want your code to expire, for Expires After (days), enter the number of days you want your code to expire after.
- Expand the Allow Resend drop-down menu, then choose Yes or No.
- Yes - allows a Resend using the same code.
- No - Generates a new code with a Resend.
- If you selected Yes in the previous step, expand the Cancel Send if Used drop-down menu, then choose Yes or No.
- Yes - Cancels the send if the coupon code has been used, or regenerates a code if it has expired.
- No - The latest generated coupon code is displayed.
- Leave your browser tab open and do not Save at this point, or you will lose your settings.
- In the Coupon Codes URL box, select the URL to copy it to your clipboard.
Paste and store the URL in notepad or a similar application as you need it in the next step.
3. Add a dynamic coupon code to an email campaign
In this step, you need to add the dynamic coupon code to your email campaign.
To add an external dynamic coupon code to your email campaign:
- In Dotdigital, go to Email > Campaigns > All campaigns.
- Edit an existing campaign or create a new campaign.
To learn how, check out Create, edit, test, and send an email campaign.
- In EasyEditor, from the Build > Building blocks > Tools menu, drag the External dynamic content block onto the EasyEditor canvas.
- Select the External dynamic content block to open the left-side settings.
- For Name, enter a name for the block.
- For Address, paste the Coupon Codes URL you generated and copied earlier.
- Finish editing your campaign and save ready for sending.
Style your coupon codes
You can customise the font and style of the coupon codes you generate. To learn how, check out the article Dynamic content: Styling options.