Populating pageviews on a SPA

urvijag76854707 20-03-2019

The application is in react js and i have done the necessary configuration. But since they have only 1 html page, the page view tags loads first time the user comes in when the user navigates to other pages I do not see page view tag populating. Is there any custom code i need to do.

Accepted Solutions (1)

Accepted Solutions (1)

asheeshp
MVP
20-03-2019

That's cause SPA doesn't refresh the page each time, it only changes page content on each view.

I agree with @Alexis on change data element event-based rule, however, that will only work when you have a key in data layer which changes its value on each page. Your best bet is to look for hash change (if your page hash changes each time) otherwise ask dev team to set _satellite.track("pageView") event on each pageview then set a direct call rule with "pageView" in direct-call rules condition. see below.

conditions_direct_call.png

Set Adobe config in the rule as s.t() and add all the necessary page variables in the settings. Also, when using direct-call rule don't forget to add return false; in custom setting under Adobe tool to eliminate double call on the landing page.

Answers (2)

Answers (2)

Alexis_Cazes_Ad
MVP
20-03-2019

If you have a data Layer and are using Adobe Launch, create a data element that reads the pagename from the data layer and create a rule obn data element change. This will be evaluate each 1 seconds so if the pagename changes based on the datalayer that will be populated each time a page changes in the SPA this will work.

If you are using fragments then create rules to look at has changes.

Otherwise you will have to look online to look at custom code that will have to look at specific DOM element that enters view and fire your code at that time