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

Sending beacon: xhr vs script

Avatar

Avatar
Validate 1
Level 1
rigor
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
rigor
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
rigor
Level 1

17-09-2020

I have AppMeasurement 2.17.0 and it sometimes sends beacons as (1) AJAX POST request and sometimes it dynamically (2) adds <script> to the page (with the same URL as AJAX request) and that results in a GET request.

xhr vs script.png

 

 

 


In case of 1 the data is encapsulated in the request body, and in case of 2 the data is sent in request parameters.

Why is that so, and is it possible to configure it to always send the beacon as AJAX POST?

 

I would like to have it that way, because it makes testing track calls with tools such as Cypress easier. Cypress, for example, is capable only of detecting AJAX requests.

Analytics

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Publish 1
MVP
yuhuisg
MVP

Likes

183 likes

Total Posts

553 posts

Correct Reply

106 solutions
Top badges earned
Publish 1
Affirm 100
Springboard
Bedrock
Validate 1
View profile

Avatar
Publish 1
MVP
yuhuisg
MVP

Likes

183 likes

Total Posts

553 posts

Correct Reply

106 solutions
Top badges earned
Publish 1
Affirm 100
Springboard
Bedrock
Validate 1
View profile
yuhuisg
MVP

17-09-2020

This was addressed in another post: https://experienceleaguecommunities.adobe.com/t5/adobe-analytics-questions/difference-between-post-v...

Basically, AppMeasurement itself decides which method to use. As far as I know, there is no user-configurable setting to force AppMeasurement to always use POST.

The next best thing that you can consider is s.useBeacon: https://docs.adobe.com/content/help/en/analytics/implementation/vars/config-vars/usebeacon.html

Answers (0)