Set a rule on 2 specific pages only | Community
Skip to main content
Level 2
June 11, 2024
Solved

Set a rule on 2 specific pages only

  • June 11, 2024
  • 1 reply
  • 930 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SofiDel_1984

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. 


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.

1 reply

bjoern__koth
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 12, 2024

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!
Level 2
June 12, 2024

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; }

 

SofiDel_1984AuthorAccepted solution
Level 2
June 12, 2024

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. 


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.