Integrate Gatsby + LoyaltyLion

Reward your customers with loyalty points for social actions liking following on Instagram, tagging in content & more.

Before getting into the step-by-step, take a look at this 1-pager on the integration and watch brief demo videos below.

Demo video of integration, showing Instagram features:

Preview of the step-by-step instructions:


Step 1: Find your LoyaltyLion Keys

Log into LoyaltyLion >> Manage >> Configuration >> Settings >> find your Token & Secret

Screenshot 2023-05-24 at 16.44.18

 


Step 2: Add LoyaltyLion Keys to Gatsby

Log into Gatsby >> Integrations >> LoyaltyLion.

Click connect and enter your Token & Secret into the fields:

 


Step 3: Update loyaltylion.liquid in Shopify

You need to complete two minor updates to your loyaltylion.liquid page in Shopify.

1. Go into Shopify >> Online Store >> Themes >> Edit Code >> Search for loyaltylion.liquid

2. Create a new line directly above </script> by clicking enter, and paste the following:

const customer_email= "{{ customer.email }}";

 

It should look like this:

Screen Shot 2022-07-01 at 7.53.59 AM

 

3. Next, go into your Gatsby account >> Integrations tab >> scroll down to the very bottom and click the 'Copy Script' button next to your 'Default Form for LoyaltyLion':

4. Paste that script that's in your mouse, the 'Default Form for LoyaltyLion' on the loyaltylion.liquid page on the very last line. As shown below:

loyaltylionliquidwithgatsby

If you prefer a video walk-through of these steps, watch below:


Step 4: Create the Social Rules of your choice, see options below:

1. Points for submitting Instagram Handle (required)

Go to LoyaltyLion >> Manage >> Create new rule >> Custom Rule

Custom Rule LL

The only two fields required for the integration to work are the Identifier fields and the Description fields, as follows:

Identifier: ig_submitted_gatsby

Description: copy/paste the follow code into the Description field, this launches the native form to collect Instagram handles.

<div class="gatsby-tiktok-rule"> <div class="gatsby-custom-form-group"> <input type="text" placeholder="Instagram Handle" name="gatsby_insta_handle" id="gatsby_insta_handle"/> <button class="gatsby-submit-button" onclick="gatsbyInstaHandleSubmitAction()">Submit</button> </div> </div>

IG received description html

The resulting form you're creating will look something like this when you're all done:

Screen Shot 2022-07-01 at 8.28.01 AM

Note: Don't worry that the code you're pasting for the description contains "tiktok-rule", it's correct.

2. Points for following you on IG

Repeat the steps to create a Custom Rule, this time use the identifier of:

Identifier: instagram_followed_you_gatsby

Description: can be whatever you would like, but we provided suggested text below:

<p>Follow us on Instagram, get 100 points</p>

<p>Note: you must complete the 'Enter Your Instagram Handle' first. Then follow us on Instagram and send us an Instagram DM with the word "followed" to get these points. If you didn't receive your points, unfollow us, DM, re-follow, and DM again.</p>

Caution: In order for Gatsby to get the most up-to-date follow data from Instagram, the profile must send you a DM after following you. So be sure to include this stipulation in the description. See example description above.

Screen Shot 2023-11-28 at 2.02.23 PM

Screen Shot 2023-11-28 at 2.02.18 PMScreen Shot 2023-11-28 at 2.01.05 PM

3. Points for tagging you on Instagram

Repeat the steps to create a Custom Rule, this time use the identifier of:

identifier: ig_mention_gatsby

Description: can be whatever you would like, but we provided suggested text below:

<p>Tag us on Instagram, earn 100 points!</p>

<p>Note: you <strong>must</strong> complete the 'Enter Your Instagram Handle' first, and be sure to tag us @xyzbrand in your Post or Story for us to track it. You can earn points for this once every 30 days.</p>

Caution: Be sure to change @username and point value in the description for your specific brand details.

Screen Shot 2022-07-01 at 8.18.10 AM

4. Points for submitting TikTok Handle (required for TikTok mention points)

Repeat Step 3, except this time use the following identifier and description:

Identifier: tiktok_submitted_gatsby

Description: 

<div class="gatsby-tiktok-rule"> <div class="gatsby-custom-form-group"> <input type="text" placeholder="TikTok Handle" name="gatsby_tiktok_handle" id="gatsby_tiktok_handle"/> <button class="gatsby-submit-button" onclick="gatsbyTiktokHandleSubmitAction()">Submit</button> </div> </div>

The resulting form you're creating will look something like this when you're all done:

Screen Shot 2022-07-05 at 11.07.22 AM

5. Points for tagging you on TikTok

Repeat the steps to create a Custom Rule, this time use the identifier of:

Identifier: tiktok_mention_gatsby

Description: can be whatever you would like, but we provided suggested text below:

<p>Publish a TikTok video with hashtag #loveXYZ to earn points!</p>

<p>Note: you <strong>must</strong> complete the 'Enter Your TikTok Handle' first, and be sure to include the #loveXYZ hashtag in your video’s caption for us to track it. You can earn points for this once every 30 days.</p>

Caution: Be sure to change #hashtag and point value in the description for your specific brand details.

Screen Shot 2022-07-01 at 8.24.31 AM

6. Points for sending Instagram DM

Repeat the steps to create a Custom Rule, this time use the identifier of:

identifier: ig_verified_gatsby
Description:
can be whatever you would like, but we provided suggested text below:

<p>Send us an Instagram DM, get 50 points</p>

<p>Note: you <strong>must</strong> complete the 'Enter Your Instagram Handle' first, and be sure to include the keyword "verify" in your Instagram DM message for us to track it. You can earn points for this once every 30 days.</p>

Caution: Be sure to change keyword and point value in the description for your specific brand details.

Screen Shot 2022-07-01 at 8.23.06 AM

7. Points for referring sales revenue

Repeat the steps to create a Custom Rule, this time use the identifier of:

Identifier: order_tracked_gatsby
Description: can be whatever you would like, but we provided suggested text below:

<p>Refer your friends, get 100 points per referral order</p>

<p>Note: you <strong>must</strong> complete the 'Enter Your Instagram Handle' first, and receive a referral code from us before being able to earn points for referrals. If you haven't received your referral code yet, contact us.</p>

Step 5. Test the integration

Once everything above is complete, you should now be able to enter an Instagram handle into the native form on your loyalty page. You'll start to see points for the different events you complete. If you have any questions, please chat us and/or open a support ticket.

Screen Shot 2022-07-01 at 9.59.55 AM

For a full demo and to see this in action, be sure to watch the videos embedded at the top of this article. Thanks, we're here if you have any questions!