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:


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: Enable the LoyaltyLion App Embed in Shopify

If you haven't already, connect Gatsby with Shopify.

Then log into Shopify and go to:

>> Sales Channels >> Online Store >> Theme >> Customize >> App Embeds

Enable the Gatsby LoyaltyLion Integration App Embed switch:

Screenshot 2025-02-21 at 10.20.01 AM

Note: There is currently a bug where enabling both Gatsby App Embed switches shown above will prevent the LoyaltyLion integration from working. While we're working on a fix, you can resolve this by toggling only the LoyaltyLion integration "on" and manually adding your primary Gatsby script to your webpage.

To find your Gatsby script:

  1. Go to Settings > Connect
  2. Scroll down and copy the script from the black bar
  3. Paste it into the <body> of the page where your loyalty program is running

If you have any questions, feel free to reach out!

 

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!