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. |
- Click on the received installation link or paste the link in the browser address bar and click enter.
- In the Shopify window, enter your Shopify credentials to log in to your Shopify portal.
- Click the Install app button.
Data Tracking
Select which data and events to track
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
|
User Events
Event Name |
Properties | Description |
---|---|---|
Page Viewed |
|
Tracked when a user visits the web page. |
Product Viewed |
|
Tracked when a user views a product. |
Product Searched |
|
Tracked when a product is searched. |
Add To Cart and Update Cart |
|
Tracked when a product is added to cart or the cart is updated. |
Removed from Cart |
|
Tracked when a product is removed from cart. |
Customer Registered |
|
Tracked when a customer registers with the Shopify store. |
Customer Logged In |
|
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 |
|
|
Order placed |
|
Tracked when a customer successfully completes the purchase . |
Item Purchased |
|
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 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.
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.
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.
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.
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
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)
3. Go to your Shopify store's admin dashboard and click on the Settings button
4. Click on "Checkout and accounts" option
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.
6. Click on the Save button
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.
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.
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
2. Click on the "Checkout and accounts" option
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
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.
5. Advanced order placed event tracking has been successfully disabled for your store.
warning |
Critical
|
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
<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
<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' %}
Next Steps
After integrating with Shopify, you can: