Expand my Community achievements bar.

SOLVED

SPA tracking without using Launch?!

Avatar

Level 3

We use the old JS method of implementing analytics. (I know, we should be using Launch! But we're not there yet!)

We're creating a new SPA mini-function on the site, and I need to be able to track each iteration of the screens. Previously for SPAs we have imported a part of the URL into the s.pagename, but for this SPA the URL will not change between screens. 

Help!? 

1 Accepted Solution

Avatar

Correct answer by
Level 8

Hi, @clairea39507456 

I'm not quite sure what your question is here. Are you looking for alternatives to the page name because the URL doesn't change? Are you looking for more information on how to track SPA content in general, or do you have that covered based on prior experience?

If it's the former, I'm assuming each screen can be assigned a unique name or value that can be used in place of the URL when building s.pageName. This could be a custom field in your CMS, something dynamically extracted from the DOM.

If you're asking how to trigger the analytics calls, I'd suggest tapping into whatever mechanism is used to change screens. When that action/event occurs, update your analytics variables and fire the page call.

If your question is about something more specific, please provide details in a follow-up and I'll offer any advice/suggestions I can.

View solution in original post

6 Replies

Avatar

Correct answer by
Level 8

Hi, @clairea39507456 

I'm not quite sure what your question is here. Are you looking for alternatives to the page name because the URL doesn't change? Are you looking for more information on how to track SPA content in general, or do you have that covered based on prior experience?

If it's the former, I'm assuming each screen can be assigned a unique name or value that can be used in place of the URL when building s.pageName. This could be a custom field in your CMS, something dynamically extracted from the DOM.

If you're asking how to trigger the analytics calls, I'd suggest tapping into whatever mechanism is used to change screens. When that action/event occurs, update your analytics variables and fire the page call.

If your question is about something more specific, please provide details in a follow-up and I'll offer any advice/suggestions I can.

Avatar

Level 2
@Brian_Johnson_, can you provide more information on how to track SPA content in general. We are moving toward SPA with dynamic content change and I would like more infor on how to track this. Any info will help

Avatar

Level 8
@keeTee - This is a pretty broad question. Are there any specifics you're trying to figure out?

Avatar

Level 2
yeah, how to track the dynamic content change.. The approach am leaning towards is to use event driven where i define customDom events for every impression loaded or clicked and rely on the Dev to dispatch this for Launch to consume. I just want to know if am on the right track.

Avatar

Level 8

@keeTee- I think that's a great approach. I've had a few scenarios where firing custom DOM events was the preferred approach, and I've found it to be both easy to work with and great at providing the information I needed, when I needed it. It's also nice because it's not analytics-specific - any system/service can subscribe to the same events.

An alternate approach would be to implement an event-driven data layer. This is another great option, and probably more of a standard. I won't go into detail on this, but will instead point you to the article below, which I think does a great job discussing the pros/cons:

https://www.datanalyst.info/web_analytics/the-event-driven-data-layer-revolution/

Avatar

Level 6

Hi @clairea39507456,

If I have understood correctly, you are looking for ways to capture the page name because the URL is not changing. So, I will suggest you to create a custom event & fire that event when the screen changes. Also, capture the variables and events and then fire s.t() or s.tl() call.

Hope this helps.

 

Regards,

Abhinav