at.js 2.x on SPA handling back button

Avatar

Avatar
Ignite 1
Level 2
sambhavj5011451
Level 2

Likes

5 likes

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Ignite 1
Level 2
sambhavj5011451
Level 2

Likes

5 likes

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 1
Boost 5
Boost 3
Boost 1
View profile
sambhavj5011451
Level 2

06-08-2019

Hi,

I had some experience Targeting Activity running on a react app. I have placed code on URL path change to trigger triggerView() function which is working fine.

I did some personalizations like changing text etc. All of them works fine when I navigate to the views via website clicks.

But when I click on browser back button, it shows the default content of view and not the content coming from Target activity.

Has anyone got similar issue and the way to resolve it.

Thanks

Sambhav

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Ignite 1
Level 2
sambhavj5011451
Level 2

Likes

5 likes

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Ignite 1
Level 2
sambhavj5011451
Level 2

Likes

5 likes

Total Posts

14 posts

Correct reply

2 solutions
Top badges earned
Ignite 1
Validate 1
Boost 5
Boost 3
Boost 1
View profile
sambhavj5011451
Level 2

21-10-2019

Hi Amelia,

If we use Launch/DTM to triggerview on URL/hash change detect, then back button will override the original content.

The solution to this is to move the triggerview function in router (in your react app) so that irrespective of from where the view is changed, triggerview will always be triggerred.

Thanks

Sambhav

Answers (2)

Answers (2)

Avatar

Avatar
Boost 3
Level 1
k_tao
Level 1

Likes

3 likes

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile

Avatar
Boost 3
Level 1
k_tao
Level 1

Likes

3 likes

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 3
Boost 1
View profile
k_tao
Level 1

01-09-2019

Hi Sambhav,

I had the same issue but have resolved it now. For me, it was because the changes were made on the 'Page load event' in Target rather than on the actual view. This meant that the change only appeared on the initial page load.

Once I added the change to the view picked up by Target, I could see the experience appearing after clicking on the back button.

Cheers,

Karen

Avatar

Avatar
Validate 250
Employee
Amelia_Waliany
Employee

Likes

192 likes

Total Posts

454 posts

Correct reply

73 solutions
Top badges earned
Validate 250
Validate 100
Validate 50
Validate 25
Validate 10
View profile

Avatar
Validate 250
Employee
Amelia_Waliany
Employee

Likes

192 likes

Total Posts

454 posts

Correct reply

73 solutions
Top badges earned
Validate 250
Validate 100
Validate 50
Validate 25
Validate 10
View profile
Amelia_Waliany
Employee

21-10-2019

Hi Sambhav! Reaching out to see if you were able to resolve the issue? Thanks for posting and we look forward to hearing from you!