There are several tutorials on how to set up LunaMetrics Ajax Event Listener. With most websites, the standard practice works as expected. However, you might run into a few problems on Single-Page apps.

There are two main reasons why the Ajax Listener doesn’t work as expected. Both of them are more commonly seen with single-page apps but they can happen with multi-page websites as well.

You are using incorrect trigger

The standard way of setting up the tag is by using Custom HTML tag and triggering it on All Pages.


Our team recently integrated NgRx into our Angular project and if you’re familiar with the library then you probably know that you can add an “optional” Router State in the store (but really, it’s not that optional).

If you prefer to keep the Store clean as I do then you also have to implement a custom serializer. Luckily NgRx official documentation has a good custom serializer example. In most cases, this is everything you need. The messy router state is filtered into string URL with route and query params.

export interface RouterStateUrl {
url: string;
params: Params;
queryParams: Params;
}

Marko Sulamägi

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store