Integrate Zapp Unique Coupon Upload

  • Updated

This integration lets you import your pre-generated coupon codes into Optimizely Data Platform (ODP) to use in your campaigns. You can use different coupon codes for various campaigns, segments, and can even assign a unique code based on a customer attribute, including assigning coupon codes exclusively to repeat customers.

integrating Unique Coupon Upload gives you the following values and benefits:

  • Track which coupon codes have been assigned to your customers.
  • Re-use the same coupon code in reminder or follow-up touchpoints.
  • Give your Support Team insights into which coupon codes have been given to customers.

This document was updated on 11/23/2020 to reflect recent changes to the app that affect coupon code configuration. If you set up a campaign using coupon codes prior to this date, please update your campaign with our new method described below.


  • Generate your coupon codes in your ecommerce platform and load them into a Google Sheet before importing them into ODP. 
  • Store the coupon files in Google Sheets and give access to the Google user who authenticates in ODP.
  • Check that the Google Sheet has been edited in the past 30 days.
  • Format the coupon files with a single-column and no header row.
  • Include "zaius_coupons" in the names of the coupon files and use unique names that have never previously been imported.
  • Use codes which have never been previously imported to ODP.

Configure Zapp Unique Coupon Upload

  1. Go to App Directory > Unique Coupon Upload > Install App.
  2. Go to Settings > Authorize to give ODP access to the required Google Sheets APIs. You should designate a single Google user for this purpose. Make sure that all coupon sheets are shared with this designated user so as to prevent new ODP users from having to re-authenticate to access new sheets.
  3. If prompted by Google, confirm your target ODP account.
  4. You should now see Get Google Sheet in your settings.

Import coupons

  1. Go to Get Google Sheet and select the Google Sheet containing your first batch of coupon codes.

    Sheet selection dropdown

  2. Enter the Coupon Rule ID (rule_id) for the coupons in the list. If you specify an existing rule_id, you will be adding these coupons to the "pool" of available coupons for that rule_id. If you specify a new rule_id, you will create a new "pool". You will use the rule_id you enter here when you are adding Liquid to your messages to request a coupon code in your campaigns. The rule_id must be lowercase, alphanumeric with underscores.

    Rule ID Specification

  3. Click Store Coupons to begin the import.

Manage your coupon rules

Click Manage Coupon Rules to view all the coupon rules you generated in ODP. When you click the dropdown, ODP dynamically assesses which rules you have and how many codes remain in each pool and displays each valid "rule_id" available for use in liquid.

Selecting a rule and clicking Purge Rule removes all remaining (undistributed) codes from that pool.

Manage coupon rules

Use coupons in a campaign

Rendering a unique coupon code in an email is simple:

  1. Add a variable name for your coupons to your copy, for example, {{coupon_code}}. Remember to request the correct rule_id in the code. (We are using “example_code” in our code snippets.)
  2. Drag-and-drop a Raw HTML element to the top of your email and copy the following Liquid code into the container:
    {% assign coupon_code = app.unique_coupons.generate_coupon(rule_id: 'example_code', email: %}

You should add a "utms" parameter, which (for emails), you can supply the auto-utms of the campaign by sending the utm_params value, like so:

{% assign coupon_code = app.unique_coupons.generate_coupon(rule_id: 'example_code', email:, utms: utm_params) %}

Remember the number of coupon codes you imported and the number of campaigns in which you use coupon codes. If the number of sends in your campaign exceeds the number of unassigned coupon codes, ODP will stop sending after the campaign has used all available unassigned coupon codes. You can keep track of the number of unassigned codes remaining for a specific rule in the Settings of the Unique Coupon Upload app. If you need more coupon codes to complete a campaign, you can upload a Google sheet with new codes under the same rule_id.

Limitations in email

You cannot include a coupon code in the subject line and preheader of your email.

Non-email channels

If a channel uses an identifier other than email address, you should use that channel's identifier for generating coupons. We have added shortcuts for both email and phone.

You can specify these or any other customer identifier manually. We still advise you to include UTM parameters, but non-email channels do not typically have automatic parameters available and need the parameters specified manually.

To use an SMS example, we would use the identifier phone like so:

{{ app.unique_coupons.generate_coupon(
  rule_id: 'example_code',
  identifier_field: 'phone',
  utms: '?utm_source=zaius&utm_medium=sms&utm_campaign=springblast&utm_content=discount')

Or, using the shortcut which is available for phone as well as email, like so:

{{ app.unique_coupons.generate_coupon(
  rule_id: 'example_code',
  utms: '?utm_source=zaius&utm_medium=sms&utm_campaign=springblast&utm_content=discount')

Campaigns with coupon codes prior to 11/23/2020

The setup for campaigns containing coupon codes changed as of 11/23. Update your campaigns based on the following steps to ensure that they will function correctly:

  1. Update the code in your static variable:
    {% assign coupon_code = app.unique_coupons.generate_coupon(rule_id: 'example code', email: %}
    Update our placeholders for "coupon_code" and "example code" with your own names for the static variable and the rule_id.
  2. Copy the resulting code.
  3. Drag-and-drop a Raw HTML block to the top of your email.
  4. Paste the code from the static variable into the Raw HTML block.
  5. Return to the bottom of your email and delete the static variable, by clicking on the X icon.

Watch our video that shows these steps: