Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Populating pageviews on a SPA

urvijag76854707
Level 2
Level 2

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.

1 Accepted Solution
Asheesh_Pandey
Correct answer by
Community Advisor
Community Advisor

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.

View solution in original post

3 Replies
AlexisCazes
Community Advisor
Community Advisor

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

Asheesh_Pandey
Correct answer by
Community Advisor
Community Advisor

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.

View solution in original post