Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.
SOLVED

Set a rule on 2 specific pages only

Avatar

Level 2

Hi everyone, 

 

I've been stuck trying to set a rule to fire on specific pages. I've tried by cc, value comparison, JS variable (and other ways). This is using Medallia Digital Experience Analytics extension. The event is set up as:

 

Events - Data Layer Manager Extension: pageLoad 

 

Conditions:

Logic Type: Regular

Extension: Core

Condition Type: Custom Code

let pagePath = _satellite.getVar('Page | Path');
if (pagePath === '/ca/en/page-1' ||
pagePath === '/ca/en/page-2/x/page2-child' ||
return true;
} else {
return false;
}

 

Actions

Extension:  Medallia Digital Experience Analytics

Action Type: Tracking Code

 

The data element is set up like:

let  PageName = _satellite.getVar('Page | Name').replace('/#/', '/');
let host = _satellite.getVar('Site | Server');
let pagePath =  PageName.replace(host, '').replace('/', '').replace('/#/', '/');

 

The tag fires on all other pages too - I'm not exactly sure why since what is set up right now should isolate it. Does anyone have any ideas?

1 Accepted Solution

Avatar

Correct answer by
Level 2

Well, we figured out the issue. We were using the extension for Medallia called  Medallia Digital Experience Analytics Extension which has 2 bugs. it loads regardless of any conditions you set to the rule. I've notified the vendor about this.

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @SofiDel_1984 

 

is there something wrong with your if condition?

 

if (

 

 

pagePath === '/ca/en/page-1' ||
pagePath === '/ca/en/page-2/x/page2-child' || <-- something missing here? Also the brackets are not closed?


return true;

 

 

} else {
return false;
}

Cheers from Switzerland!


Avatar

Level 2

no, my code got edited when I posted it...i reviewed the hierarchy again (I have to modifying it since I can't share the actual URL here)

 

page 1 is the "homepage"

page 2 (is a site section but the entire site has the path that starts with /ca/en/page1-x/ for example

 

if (pagePath === '/ca/en/page1-x' ||
    pagePath === '/ca/en/page1-x/b/page2-b' || {
  return true;
} else {
  return false;
}

 

Avatar

Community Advisor

 

so technically

 

return pagePath === '/ca/en/page1-x' || pagePath === '/ca/en/page1-x/b/page2-b'

 

or alternatively 

 

return ['/ca/en/page1-x', '/ca/en/page1-x/b/page2-b'].includes(pagePath)

 

 

And this does not work?

are you sure the pagePath is set correctly at this moment? Maybe worthwhile printing it out in the console

Cheers from Switzerland!


Avatar

Level 2

yea the path is set correctly when I'm printing it console 

 

I also modified the script with your suggestion and while the Adobe Launch rule does not load on pages where I don't expect it, the Medallia tag still loads in Omnibug. 

Avatar

Correct answer by
Level 2

Well, we figured out the issue. We were using the extension for Medallia called  Medallia Digital Experience Analytics Extension which has 2 bugs. it loads regardless of any conditions you set to the rule. I've notified the vendor about this.

Avatar

Community Advisor

Glad you figured it out! Assume it's bit like the Meta/Facebook extension that fires always, irrespective of any given consent, and you can only control additional events to be triggered...

 

cheers

Cheers from Switzerland!