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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Cannot send beacon: TypeError: window.location.query is not a function

puckingfeachy
Level 1
Level 1

Hi there -

Hoping you can help me understand why I a getting the error: 

Cannot send beacon: TypeError: window.location.query is not a function

 

Here is the window.location.query code I found in the Launch library that I think is causing the issue:

settings: {
orgId: "Xreplaced the value hereX@AdobeOrg",
customSetup: {
source: function() {
console.log(window.location.query("cmp"))
}
}, 

 

In Launch, I have a data element %campaignid% that is set to capture value from cmp query string parameter. 

puckingfeachy_0-1620842678731.png

 

This value is passed on global page view and one other rule.

 

The page view isn't showing up in Adobe.

 

Am I missing something? Is there something else I can share to make the scenario more clear?

 

Thanks,

 

PFeach

 

6 Replies
puckingfeachy
Level 1
Level 1

Someone added console.log(window.location.query("cmp")) to custom code section in Adobe Analytics extension. Was it me? May very well have been. I am not here to point fingers, lay blame; I'm here for the laughs - the highs, the lows and all the in-betweens.

Thanks.

yuhuisg
Community Advisor
Community Advisor

I'm not sure where that code is coming from. I'm pretty sure it's not from the Core extension itself. It looks like it could be coming from a Condition or Action in one of your Rules.

Anyway, try replacing "window.location.query" with just "location.query".

tim_funk
Level 2
Level 2
query is not an property on location. Based on the name, it seems like query means query-string is desired. In which case - that would be "location.search"
puckingfeachy
Level 1
Level 1

I found it in the Custom Code section, Adobe Analytics extension. There really is no need for it and it is causing errors...so I've removed it. Thanks for your most helpful reply.

@tim_funk  - but how to return value from QSP? namely cmp value. location.search seems to provide the whole QSP...while I am looking for specific value.

tim_funk
Level 2
Level 2

I see the Storage duration is set to session - So I suspect the initial page view was missing that parameter so that value carried as empty the rest of the session.

 

https://experienceleague.adobe.com/docs/launch/using/ui/data-elements.html?lang=en