Custom Action Earning Rule

      Custom Action Earning Rule


        Article Summary

        Products


        Loyalty & Referrals
        Supported plans

        Platinum, Enterprise

        eCommerce Platform

        Shopify, Shopify Plus, BigCommerce, Salesforce Commerce Cloud, Adobe Commerce (Magento), Custom

        The Custom Action is an advanced earning rule (previously known as a campaign) that allows you to reward customers for performing an action of your choice. It is a way for brands to think creatively about their programs and reward their customers for actions that are uniquely valuable to their business: 

        • Run uniquely formulated earning rules that are tailored for your shoppers. For example weekly draws, donation-earning rules, form submissions, online gaming events. etc.
        • Integrate with 3rd party applications for completing an action within that platform.
        Important:
        This earning rule requires technical expertise and the use of API.

        Creating a Custom Action earning rule

        Shopify and Shopify Plus
        1. From your main menu, go to Set Up Program > Rewards Program. 
        2. Click on Create earning rule.
        3. Under Advanced select Custom action, then click Next.
        All other eCommerce platforms
        1. From your main menu, go to Set Up Program > Earning Rules. 
        2. Click on Create earning rule.
        3. Click Select on Custom action.

        Setting up your Custom Action earning rule

        Create and customize your very own earning rule.

        Below are the descriptions of each setting found in your earning rule for your reference.

        General settings

        • Action Name - This is the name of the action that needs to be completed to receive the reward. It is the same action name that you register to Yotpo's API as the action to trigger Yotpo Loyalty and Referrals to send rewards. This will not be visible to your customers.
        • Campaign Name - This is the name of the earning rule as it appears on the rewards pop-up or rewards page. By default, the name is set to "Custom Action", you may change it according to your preference
        • Description Text - The text that appears on the pop-up window after a customer clicks on the earning rule. It gives a brief idea of how a Custom Action reward can be earned
        • What kind of Reward - Choose the kind of reward that you wish to give to your customers. Reward either a discount coupon or loyalty points, for completing the earning rule. Some fields on the setup change depending on the type of reward that you choose. If you select:
        Points

        The field "How many points?" will appear when you choose to reward your customers with points. This is where you can enter the number of points to be given to shoppers after completing the earning rule.

        Coupon

        The field "Which coupon should the customer get?" will appear. You may then select from the dropdown which coupon to apply for the specific earning rule. 

        Important:
        Initially, the coupon selection is at $ 0.00 as no coupon still exists. You may refer to Creating a Coupon article to learn how to create coupons
        • Reward Text - The text that usually appears under the title and shows the customer what they will receive if they participate in the earning rule. The Rewards Text will also be reflected in the Rewards History.
        Please note:

        Please make sure that the reward text matches your chosen reward as it will not change automatically when you change the reward

        • Icon -The default icon for the custom action earning rule is a gear, however, you can replace it with any other Font Awesome icon
        • Already Completed Message - This message will appear once your customers click on an earning rule that they have already completed. 

        Platform-specific settings

        Some settings may change according to the eCommerce platform you're using. Click on the platform relevant to you to see the full list of available advanced settings.

        Shopify & Shopify Plus
        • Exclude or Include specific customer tags – This selection allows you to limit the earning rule to specific customers 
        • Customer Tags- A label that you create in your eCommerce platform to filter or group customers according to specific criteria. When this setting is populated, it will only make the earning rule either available or unavailable to the customers with the specific customer tag
        • Maximum Times Completed Total - The maximum number of participants that can complete the earning rule (E.g. if you set it to 50 only the first 50 customers to finish the earning rule will get the reward.)
        • Minimum Actions Required - The minimum number of times a user may perform this action.
        • Maximum Times Complete Per User - The maximum number of times a single user can participate in this earning rule
        • Restrict to VIP tiers - This field will allow you to create a earning rule with specific rewards per VIP Tier
        • Display On-Site? - By default this is toggled to "Yes", meaning that if you save this earning rule after creating/editing, it will be visible on your Rewards Page. Select "No" if you'd like to set up an earning rule that doesn't appear on your Rewards Page.
        • Schedule Campaign - This will allow you to run a special promotion for a limited period of time, or a promotion that recurs daily, weekly, or monthly.
        Adobe Commerce
        • Maximum Times Completed Total - The maximum number of participants that can complete the earning rule (E.g. if you set it to 50 only the first 50 customers to finish the earning rule will get the reward.)
        • Minimum Actions Required - The minimum number of times a user may perform this action.
        • Maximum Times Complete Per User - The maximum number of times a single user can participate in this earning rule
        • Restrict to VIP tiers - This field will allow you to create an earning rule with specific rewards per VIP Tier
        • Display On-Site? - By default this is toggled to "Yes", meaning that if you save this earning rule after creating/editing, it will be visible on your Rewards Page. Select "No" if you'd like to set up an earning rule that doesn't appear on your Rewards Page
        • Schedule Campaign - This will allow you to run a special promotion for a limited period of time, or a promotion that recurs daily, weekly, or monthly.
        BigCommerce
        • Exclude or Include Specific Customer Group Ids – This selection allows you to limit the earning rule to specific customers 
        • Customer Group Ids - This will require the order to include specific group IDs to receive a reward if populated.
        • Maximum Times Completed Total - The maximum number of participants that can complete the earning rule (E.g. if you set it to 50 only the first 50 customers to finish the earning rule will get the reward.)
        • Minimum Actions Required - The minimum number of times a user may perform this action.
        • Maximum Times Complete Per User - The maximum number of times a single user can participate in this earning rule.
        • Restrict to VIP tiers - This field will allow you to create an earning rule with specific rewards per VIP Tier
        • Display On-Site? - By default this is toggled to "Yes", meaning that if you save this earning rule after creating/editing, it will be visible on your Rewards Page. Select "No" if you'd like to set up an earning rule that doesn't appear on your Rewards Page.
        • Schedule Campaign - This will allow you to run a special promotion for a limited period of time, or a promotion that recurs daily, weekly, or monthly.
        Generic
        • Maximum Times Completed Total - The maximum number of participants that can complete the earning rule (E.g. if you set it to 50 only the first 50 customers to finish the earning rule will get the reward.)
        • Minimum Actions Required - The minimum number of times a user may perform this action
        • Maximum Times Complete Per User - The maximum number of times a single user can participate in this earning rule
        • Restrict to VIP tiers - This field will allow you to create an earning rule with specific rewards per VIP Tier
        • Display On-Site? - By default this is toggled to "Yes", meaning that if you save this earning rule after creating/editing, it will be visible on your Rewards Page. Select "No" if you'd like to set up an earning rule that doesn't appear on your Rewards Page.
        • Schedule Campaign - This will allow you to run a special promotion for a limited period of time, or a promotion that recurs daily, weekly, or monthly.
        Tip:
        It is highly recommended to adjust the Maximum Times Completed Per User or the total number of times a customer can earn a reward for completing an action. This is to prevent manipulation of the number of entries to gain rewards.

        Setting up the API

        In order to reward customers for completing an action outside your Yotpo loyalty program, you need to establish a communication of action completion either by manually sending an API call OR by automating the API call.

        Important:
        API calls must be made server-side or through a proxy server.
        If you try making the call from the client side you will receive a CORS error as this may expose sensitive data.

        To automate the API call, you need to use this API endpoint and follow the steps below:

        1. Decide on the action to be performed and its action name.
        2. Create the automation that triggers the API call to Yotpo. To do that, have your developer create a code snippet wherever the event fires (i.e. on "Submit "button of a form).
        Sample code snippet format

        To adjust the code below, do the following:

        • Replace completed_survey with the desired action name.
          For example completed_form
        • Replace 12345 with your merchant ID - found in Settings
        • Replace MY_API_Key (keep " ") with your API key - found in Settings
        • Refer to our dev docs for complete directions

        require 'faraday'
        action = Hash.newaction = "CustomAction"
        action = "john@example.com"
        action = "completed_survey"
        # add authentication params (could also use headers)
        action = 12345
        action = "MY_API_KEY"

        conn = Faraday.new(:url => "https://app.swellrewards.com")

        response = conn.post do |req|
            req.url "/api/v2/actions"
            req.headers = 'application/json'
            req.body = action.to_jsonend

        Need to find your API Key?
        For instructions on how to find your Merchant ID and Yotpo Loyalty & Referrals API Key, click here
        1. You may now set up your custom action earning rule with the action name that you have recently created via API.

        Was this article helpful?