Expand my Community achievements bar.

Best practices for Single-Page Apps

Avatar

Level 2

What are the best practices for Single-Page Apps tracking using Launch? Basically, I'm looking for a robust techique for collecting / dispatching virtual pageviews (JS framework agnostic).

Here https://marketing.adobe.com/resources/help/en_US/experience-cloud/launch/c_extension-dtm.html I found that Launch Core extension contains events like “Custom Event” and “Data Element Changed”.  I suppose I should use one of these features, but not sure which one to select as I don’t know their pros and cons. 

On the web I found some examples for DTM only, I don’t know if they are applicable to Launch.

When working with GTM, I used custom events for these purposes. However custom events in GTM are just key-value pairs pushed into the GTM data layer. But in the DTM-related articles which I saw on the web custom events refer to something absolutely different: Javascript-native interface called CustomEvent: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent

Any suggestions / documentation on this?

Thanks a lot!

22 Replies

Nice... looks very familiar...

with the difference that we use a message queue instead of an event array "in between"... gives us some other options, like having multiple subscribers to the same message queue... messages can be cached, and replayed to a new subscriber... waiting for listeners to be subscribed (aka waiting for Launch/Analytics to be loaded)... prioritize "page view" message (aka it is called before any other event messages on the same page, so that page context can be served with the other events)...

I have some colleagues who have build this way of working on top of Angulartics in Angular2, making use of the Service queue principle to pass the events...

But definite a very good approach to more event based analytics... and very useful...

Avatar

Community Advisor

Screen Shot 2018-11-15 at 1.27.07 PM.png

In the version going up today (1.0.6) of Data Layer Manager, we have added getters on each event that provides __meta.computedState from the viewpoint of each event (to answer the question, "What is the combined state of this event and prior pushed events?").

This allows the event context to be available (in conditions and actions) to any rule triggered by the event.  Soon the event context will also be available to data elements as well. 

Screen Shot 2018-11-15 at 1.35.05 PM.png

Event-based analytics!  YES!  I do hope that many people will find this useful.