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

Direct call rules in SPA (Single Page Application) async deployment

Avatar

Avatar
Validate 1
Level 1
galynai3258253
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
View profile

Avatar
Validate 1
Level 1
galynai3258253
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
View profile
galynai3258253
Level 1

16-09-2020

Hello 🙂 

 

We use _satellite.track to track pageviews in the Single Page Application while the Adobe script loads asyncronously. As expected, sometimes we get error message: _satellite is not defined. It means that the _satellite.track had been fired before the script finished loading.

 

What is the best way to solve this issue technically? Is there any method recommended by Adobe? 

 

Thank you in advance.

Galyna

 

 

 

View Entire Topic

Avatar

Avatar
Affirm 50
MVP
evolytics_brian
MVP

Likes

80 likes

Total Posts

170 posts

Correct Reply

54 solutions
Top badges earned
Affirm 50
Applaud 25
Establish
Seeker
Give Back
View profile

Avatar
Affirm 50
MVP
evolytics_brian
MVP

Likes

80 likes

Total Posts

170 posts

Correct Reply

54 solutions
Top badges earned
Affirm 50
Applaud 25
Establish
Seeker
Give Back
View profile
evolytics_brian
MVP

16-09-2020

I think the only real option here is to code around the context of your site. Before calling _satellite.track(), make sure it exists. This could be done in various ways...

  • Define your data layer on the page and move the _satellite.track() call into Launch.
  • Create an interval that continuously checks for the _satellite object, only calling _satellite.track() when you're certain it exists on the page.
  • Create a page load rule that notifies the page that _satellite has loaded and is ready to go. When that rule fires, use it to trigger your _satellite.track() call(s) by emitting a custom JS event that can be subscribed to with a simple document.addEventListener() in your page content. (Or, set a JS variable on the window that, when present/populated, tells the page that you're ready for the _satellite.track() calls to fire.)

You have a lot of options, but at the end of the day, it's just a timing challenge, and you'll have to decide what fits best in your environment.