Shopify (E-Com Platform) - V2

Introduction

Shopify <> Moengage integration allows you to seamlessly integrate Moengage Web SDK to your brand's shopify store to track user events and user data . You can use channels web push, on-site messaging, SMS, Email, web personalisation, to reach out to your store visitors to nudge them towards converting. 

A limited set of data is tracked automatically by the MoEngage Shopify app. 

Integration prerequisite 

Option to add a shopify integration can only be possible after submitted the shopify integration form. Please ask your Customer success manager(CSM) to fill it for you.  

Once filled successfully with all the required details you will receive an installation link that can be used to install our shopify app into your shopify store. The installation link are only valid for 7 days so please reach out to regenerate the installation link if it goes stale. 

Authenticate and install app

info

Note

Ensure you have Shopify Store Admin credentials.

  1. Click on the received installation link or paste the link in the browser address bar and click enter. 
  2. In the Shopify window, enter your Shopify credentials to log in to your Shopify portal.
  3. Click the Install app button.
    moengage-test-store.myshopify.com_admin_oauth_request_grant_access_change_uuid_1aacb054-0ad2-4e48-a149-2c9a1b1486f0_client_id_32fb20fdc13f7398582bc54356bb657a__2_.png

Data Tracking

Select which data and events to track

Screenshot_2022-10-03_at_3.25.59_PM.png

Select the data and events and click on Save to start tracking these user attributes and events automatically by MoEngage. These attributes and events will only be tracked for users visiting your store after installing the app. 

The data tracking page is the home page of the app. Access the home page from the Shopify admin portal -> Apps -> MoEngage 2.0

info

Note

  • If you are changing the Shopify Theme, then you have to visit this Config page again and click Save. We do not support auto-tracking of data and events for customized themes.
  • You can also track any other data using our Data tracking APIs by writing the code directly into your store apart from the following user events and user attributes. For more information, refer to Web SDK User Attributes Tracking and Web SDK Events Tracking

User Events

Event Name

Properties Description

Page Viewed

  • URL

Tracked when a user visits the web page.

Product Viewed

  • Available - True/False

  • Currency

  • Product Handle

  • Product ID

  • Price

  • Product Title

  • Total Variants

  • URL

  • Source : Shopify

Tracked when a user views a product.

Product

Searched

  • URL
  • Currency

  • Search String

  • Source : Shopify

Tracked when a product is searched.

Add To Cart and Update Cart

  • URL
  • currency

  • Image URL

  • Product Price

  • Product ID

  • ProductType

  • Quantity

  • Product Title

  • Product URL

  • Variation ID

  • Variation Title

  • Vendor name

  • Source : Shopify

Tracked when a product is added to cart or the cart is updated.

Removed from Cart

  • URL
  • currency

  • Image URL

  • Product Price

  • Product ID

  • ProductType

  • Product Title.

  • Product URL

  • Variation ID

  • Variation Title

  • Vendor name

  • Source : Shopify

Tracked when a product is removed from cart.

Customer Registered
  • Email
  • FirstName

  • LastName

  • Customer ID

  • URL
  • Source : Shopify

Tracked when a customer registers with the Shopify store.

Customer Logged In

  • Email

  • FirstName

  • LastName

  • Customer ID

  • URL
  • Source : Shopify

Tracked when a customer logs in to the Shopify store.

Customer Logged Out

None

Tracked when a customer logs out of the Shopify store.

Checkout Started

  • Product quantity

  • currency
  • Total Price
  • Product Price (Array)
  • Product ID (Array)
  • Product Title (Array)

  • Variation ID (Array)

  • Vendor name (Array)
  • URL
  • Source : Shopify

 

Order placed

  • Order Id

  • Image URL (Array)

  • Product Price (Array)

  • Product ID (Array)

  • Quantity (Array)

  • Product Title (Array)

  • Variation ID (Array)

  • Variation Title (Array)

  • Vendor name (Array)

  • TotalItems

  • currency

  • Total Price
  • URL
  • Source : Shopify

Tracked when a customer successfully completes the purchase .

Item Purchased

  • Order Id

  • Image URL

  • Product Price

  • Product ID

  • Quantity

  • Product Title

  • Variation ID

  • Variation Title

  • Vendor name

  • currency

  • URL
  • Source : Shopify

Tracked for each item purchased when the order is placed.

User Attributes

Attribute Name Description
First Name First Name of the user.

LastName

Last Name of the user.

Mobile Number

Mobile Number of the user.

 

Email

Email address of the user.

Client ID

Id of the user in MoEngage (Email ID by default)

Shopify Tags

Tags used for the user by Shopify.

Accepts Marketing

Shopify attribute 

Orders Count

Number of orders placed by the user.

LTV

Life Time Value of the user. This is the total sum of revenue present in the App Conversion Goal event performed by a user. LTV is updated every time the app conversion goal event is executed by the user.

Shopify Id

Id of the user in Shopify.

Past data sync

You can track past users and past orders using our app. Past data means the users and orders that were created on your store before you installed our V2 app.

info

Note

Ensure that a Data API Key exists for your MoEngage account before syncing past users or past orders by going to your MoEngage dashboard -> Settings -> APIs. If the DATA API KEY field is blank, then create the key once by clicking on the GENERATE KEY button and then on the SAVE button

Past users

Up to 10,000 users that were created before app installation will be tracked. Users are tracked in descending order of their creation time (i.e., the latest 10,000 users (max) created before app installation time will be tracked)

Past orders

Only the last 60 days orders from the time you enable "Sync last 60 days orders" from our Config page will be considered for tracking and from this pool of orders, upto 10,000 orders that were created before app installation will be tracked. Orders are tracked in descending order of their creation time (i.e., the latest 10,000 orders (max) created before app installation time will be tracked)

States of the sync process

1. When you reach the Config page of our app, you would see that the options to perform past users sync and past orders sync are enabled.

Screenshot_2022-10-03_at_3.25.59_PM.png

2. When you start the sync for past user and/or past order, the state of the sync process changes to “in-progress”. In this state, you cannot restart the sync process.

Screenshot_2022-08-28_at_5.47.27_PM.png

3. When the syncing is successfully finished, the state of the sync process changes to “completed”. In this state, we do not provide the option of re-sync as all past users/orders had already successfully synced.

Screenshot_2022-08-28_at_5.53.13_PM.png

4. If the syncing gets failed for some reason then after 24 hours from the time you started the sync, the state of the sync process changes from in-progress to "failed". In this case, we enable the option to sync past users/orders again.

Screenshot_2022-08-28_at_5.43.07_PM.png

Scanned and synced count values

1. The number of users and orders which were created before you installed our app is denoted by the "Existing users" and "Past orders placed" values respectively
2. "Users synced" and "Past orders synced" values denote the number of users and orders (respectively) which-
(i) Were created before you installed our app
(ii) Have an email associated which them
(iii) Our app was successfully able to track

info

Note

We track a custom event named "Previous User Tracked" with each past user that our app was successfully able to track. Past orders are tracked with the same event names- "Item Purchased" and "Order Placed" as mentioned above in the User Events section.

Additional Scripts Integration for Non-Shopify Plus Stores

info

Note

This feature is only for non-Shopify Plus stores. Shopify Plus stores must NOT follow these steps.

Integrating Additional scripts

If your store is not on Shopify Plus plan, please follow the below steps to enable advanced order placed event tracking. This will help in tracking Order placed events as quickly as possible for your store.

1. When you reach the Config page of our app, you will find the "Advanced order placed event tracking" option

Screenshot_2022-12-21_at_11.16.29_AM.png

2. Enable that option and you will find the scripts that you need to add in the Additional scripts area of your Shopify store's admin dashboard (the scripts in the picture below are dummy and are just for the purpose of example; please copy the scripts which are presented to you on the Config page of your app only)

Screenshot_2022-12-21_at_11.18.02_AM.png

3. Go to your Shopify store's admin dashboard and click on the Settings button

Screenshot_2022-12-21_at_12.02.28_PM.png

4. Click on "Checkout and accounts" option

Screenshot_2022-12-21_at_12.03.17_PM.png

5. Scroll down on the right hand side of this option. Paste the scripts that you have copied from the Advanced order tracking section of your app's Config page into the "Additional scripts" scripts area.

Screenshot_2022-12-21_at_12.03.39_PM.png

6. Click on the Save button

Screenshot_2022-12-21_at_12.10.33_PM.png

7. After this, revisit your app's Config page and click on the Save button. You will get a confirmation dialog asking whether you have correctly added the scripts in the Additional scripts area. Click on the OK button.

Screenshot_2022-12-21_at_11.18.21_AM.png

8. After this, the integration of additional scripts is successful. Now, the tracking on the thank you page of your store will be done through the additional scripts. If you revisit your app's Config page, you will see the label "Enabled" adjacent to the "Advanced order placed event tracking" option.

Screenshot_2022-12-21_at_11.19.16_AM.png

warning

Critical

Make sure you have followed the above steps correctly if you have enabled the "Advanced order placed event tracking" option. Not doing so will STOP Order placed events tracking.

Removing Additional scripts

If you wish to disable the Advanced order placed event tracking (not recommended), then follow the below steps

1. Go to your Shopify store's admin dashboard and click on the Settings button

Screenshot_2022-12-21_at_12.02.28_PM.png

2. Click on the "Checkout and accounts" option

Screenshot_2022-12-21_at_12.03.17_PM.png

3. Scroll down on the right-hand side of this option. Remove the scripts that you had earlier copied and pasted into the Additional Scripts area and click on the Save button

Screenshot_2022-12-21_at_12.16.10_PM.png

4. Visit your app's Config page, disable the "Advanced order placed event tracking" option and click on the Save button. You will get a confirmation dialog asking whether you have correctly removed the scripts from the Additional Scripts area. Click on the OK button.

Screenshot_2022-12-21_at_11.19.46_AM.png

5. Advanced order placed event tracking has been successfully disabled for your store.

warning

Critical

  • If you are disabling the "Advanced order placed event tracking", make sure you have removed the scripts from the Additional scripts area of your Shopify store's admin dashboard. Not doing so could result in duplicate Order placed events tracking.
  • If you are moving from a non-Shopify Plus plan to a Shopify Plus plan and if you had added the scripts in the Additional scripts area of your Shopify store's admin dashboard, then please remove the scripts from there as it could result in duplicate Order placed events tracking.
  • If you have uninstalled our Shopify V2 app and if you had added the scripts in the Additional scripts area of your Shopify store's admin dashboard, then please remove the scripts from there; otherwise, MoEngage will still track events and attributes on the "thank you page" of your store.

Web Personalization

In order to use Web Personalisation in Shopify, you can use the following code:

write this just before the ending of <head> tag in theme.liquid file

JavaScript
<script type="text/javascript">
window.addEventListener('MOE_LIFECYCLE', function(data) {
if(data.detail.name === 'SDK_INITIALIZED') {
// write web personalisation code here
}
})
</script>

For more info on Web Personalisation, please refer to this doc.

Migrating to V2

If you have Moengage SDK already installed in you Shopify store and you want to install the new version, then follow the following steps:
1. Uninstall the Moengage app: Shopify admin portal -> Apps -> Moengage

2. Remove the SDK code from theme.liquid file: Shopify admin portal -> Online Store -> Actions -> Edit Code -> theme.liquid

JavaScript
<script type="text/javascript"> (function(i,s,o,g,r,a,m,n){i.moengage_object=r;t={};q=function(f){return function(){(i.moengage_q=i.moengage_q||[]).push({f:f,a:arguments})}};f=['track_event','add_user_attribute','add_first_name','add_last_name','add_email','add_mobile','add_user_name','add_gender','add_birthday','destroy_session','add_unique_user_id','moe_events','call_web_push','track','location_type_attribute'],h={onsite:["getData"]};for(k in f){t[f[k]]=q(f[k])}a=s.createElement(o);m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m);i.moe=i.moe||function(){n=arguments[0];return t};a.onload=function(){if(n){i[r]=moe(n)}}})(window,document,'script','https://cdn.moengage.com/webpush/moe_webSdk.min.latest.js','Moengage') 
Moengage = moe({
app_id:'YOUR-APP-ID',
debug_logs: 0,
swPath: '/tools/moengage/sw.js'
});
</script>
{% include 'moe.liquid' %}

bc3c010-4_ed.png

Next Steps

After integrating with Shopify, you can:

Was this article helpful?
0 out of 1 found this helpful

How can we improve this article?