Order of Pipelines for the Analytics Tracker

Order of Pipelines for the Analytics Tracker

I have been working on a new Tracker modification that I will be releasing on the marketplace soon. What I had trouble with was the order and running of the pipelines for the Tracker.

I have my Tracker calling out to an API to gather some details on the user and each of these calls cost a little money. So when I placed my pipeline in the startTracking pipeline I was surprised to see that my code was called on every page load. So I moved the code to the initializeTracker pipeline, same issue. It was called on every page load.

My last thought was to move all the way back to the createVisit pipeline. This is the one that fills the tracker with all the user's information like browser, size, IP, etc... You can see in the image below the class that loads up all the user's info.

After the change I got the result I wanted. When the user visited the site, my code ran and was never called again. In the end, this made perfect sense. But up until that point it was confusing me greatly.

I wanted to give thanks to Martin Davies for this post that helped me find the order of the pipelines running.