Professor Sloth

Free web performance master class

Learn about web performance and how to make your site faster, delivered straight to your inbox.

Shopify Integration

Installing Request Metrics into your Shopify store for real user monitoring and web performance is easy. It only takes a few minutes to add our code to your theme.

Installing Request Metrics into your Shopify store for real user monitoring and web performance is easy. It only takes a few minutes to add our code to your theme.

Installing Request Metrics in your Shopify Store

You add the Request Metrics snippet to your theme’s layout.liquid file, so that it gets included on every page. Here’s how you do it:

  1. Open your Shopify store admin dashboard and go to “Online Store” -> “Themes”.
  2. Click the “…” next to your current theme, and select “Edit code”.
  3. From the file list on the left side, select theme.liquid
  4. Somewhere in the <head> tag, paste the following snippet code. Be sure to change your:token to your Request Metrics token.
<!-- Request Metrics -->
<script>
  (function(t,e,n,r){function a(){return e&&e.now?e.now():null}if(!n.version){n._events=[];n._errors=[];n._metadata={};n._urlGroup=null;window.RM=n;n.install=function(e){n._options=e;var a=t.createElement("script");a.async=true;a.crossOrigin="anonymous";a.src=r;var o=t.getElementsByTagName("script")[0];o.parentNode.insertBefore(a,o)};n.identify=function(t,e){n._userId=t;n._identifyOptions=e};n.sendEvent=function(t,e){n._events.push({eventName:t,metadata:e,time:a()})};n.setUrlGroup=function(t){n._urlGroup=t};n.track=function(t,e){n._errors.push({error:t,metadata:e,time:a()})};n.addMetadata=function(t){n._metadata=Object.assign(n._metadata,t)}}})(document,window.performance,window.RM||{},"https://cdn.requestmetrics.com/agent/current/rm.js");
  RM.install({
      token: "your:token"
  });
</script>

NOTE: Shopify uses different controls for the checkout flow of stores and tightly controls the JavaScript that runs for security purposes. There is currently no way to add Request Metrics to checkout page itself.

Request Metrics Shopify App

There is also a Shopify app for Request Metrics in development that automates this and gives you navigation controls. If you are interested in using the app or joining our beta, contact us!

Did you like this?
Found a mistake? Let us know!