1. Home
  2. Cookieless Web Analytics
  3. How to track SPA web pages

How to track SPA web pages

We’ve updated our pixels, currently, the same pixel can be used with all kinds of technology: ajax, spa,….

  1. When you need to track page views:

<script>
 /* SealMetrics Tracker Code */
 var oSm = window.oSm || {};
 oSm.account = '60a52f6ac660b269d13c3f53';
 oSm.event = 'pageview';
 !function(e){var t="//app.sealmetrics.com/tag/tracker";window.oSm=oSm,window.smTrackerLoaded?sm.tracker.track(e.event):Promise.all([new Promise(function(e){var n=document.createElement("script");n.src=t,n.async=!0,n.onload=function(){e(t)},document.getElementsByTagName("head")[0].appendChild(n)})]).then(function(){sm.tracker.track(e.event)})}(oSm);
 /* End SealMetrics Tracker Code */
</script>

2. Once a user submits the form or make a conversion, this code should be triggered:

<script>
 /* SealMetrics Tracker Code */
 var oSm = window.oSm || {};
 oSm.account = '60a52f6ac660b269d13c3f53';
 oSm.event = 'pageview';
 !function(e){var t="//app.sealmetrics.com/tag/tracker";window.oSm=oSm,window.smTrackerLoaded?sm.tracker.track(e.event):Promise.all([new Promise(function(e){var n=document.createElement("script");n.src=t,n.async=!0,n.onload=function(){e(t)},document.getElementsByTagName("head")[0].appendChild(n)})]).then(function(){sm.tracker.track(e.event)})}(oSm);
 /* End SealMetrics Tracker Code */
</script>


This conversion pixel could be added before/after page view tracking pixel. For us, the order you trigger each pixel doesn't matter.
Updated on julio 21, 2022

Was this article helpful?

Related Articles