How to set up and debug virtual pageview for a react web app

Mordern Web App

If you’re a web developer, you might be familiar with React, Angular etc, but other people don’t know the technology behind it has changed a lot.

PerfectCuisine is complicated, we built it with several react app.

I realized our tracking problem when our marketer tried to set up a conversion measurement, we need setup a pageview as a goal, but this pageview is just a view of a react app which can’t be tracked by GA directly.

It’s hard to debug Google analytics and Google tag manager

if you’re using react router, then it’s easy, you just need put the code below to your router file, it will work.

browserHistory.listen(location => {
    const { pathname } = location;
    if (typeof === "function") {'gtm1.set', 'page', pathname);'gtm1.send', 'pageview');

But things are not always going well, if you’re following the official doc, you might use the code below:, 'page', pathname);, 'pageview');

It doesn’t work and it doesn’t report any errors, you have to install a plugin google analytics debugger in your chrome to debug it.


bootstrapping perfect cuisine


After PeachDish is closed, I helped bootstrap another meal kit e-commerce perfect cuisine with Richard.

It’s like a upgrade version of PeachDish, client can customize ingredient for every menu.

It’s launched, we start from Adwords, trying to grow it.

I never think about growing six years ago when I join PeachDish, I guess too much need to do about technology on that time.

But now I have a lot of technology accumulation, I also know the importance of the growing for an e-commerce business.

So I’m focusing more on stuff which can help bring us more customers.

Perfect cuisine is focus one province, but PeachDish shipped for the whole US from the very beginning. So the strategy might be different, we’ll use offline print advertising, but for now we’re still focusing improving UX to make signing up easier.

Confusing about bootstrapping strategy

We’re using a digital experience analytics tool to know how our customers use our website, and improve UX from guessing their intention.

We also set up google analysis and e-commerce conversion to tracking some metrics, but I still feel like something is missing.

I’m afraid we just set it up, but never use these data to guide our decision.

Another issue is we never know if our improvement is helpful, it might be the transition from quantity to quality.

But I still think if we can have a effective tracking system, it could shorten the time to Product/market fit.

I guess I need re-read book: Traction: A Startup Guide to Getting Customers to get some insights.

Richard is trying to hire another marketer, I hope we can have a solid marketing plan soon.