Expand my Community achievements bar.

SOLVED

Template Rule in page delivery

Avatar

Level 3

Hi,

I want to implement a usecase where the requirement is to have the same experience on multiple pages.

Its actually a change in Header which we want to implement for a specific set of pages for a specific audience.

 

for example setting an activity on below url

/content/a/b/c.html

made some changes here on page "c', and Now I want to have similar experience on all the pages comes after "c" in content hierarchy .

example 

/content/a/b/c/d.html

/content/a/b/c/e.html

/content/a/b/c/f.html

etc..

 

I tried Page delivery option with additional template rules

as URL contains "c"

or path contains "c"  like this many things.

 

But that did not worked..

 

I tried Adding pages functionality as well it worked but then I have to add all pages again and again and make changes in each one of them.

..

if anyone has implemented this before please do let me know.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Ok, so if you take the CSS selector that's being used in the modification in Visual Editor, visit one of the pages where the change doesn't work, and use

document.querySelector('your-css-selector')

Does that return an element? I.e., it doesn't return null


View solution in original post

4 Replies

Avatar

Employee Advisor

A template rule of, for example, "URL contains /content/a/b/c/" should work fine.

There are two things that might be happening:
i) You're not qualifying for the activity
When you visit, for example, /content/a/b/c/d.html are you entered into the activity?
-You can check this in the response from Target. 

ii) You're qualifying for the activity but the Target modifications aren't being applied
The html might be different on each of the pages e.g. you've designed your experience in the Visual Editor and the modification is applied to a particular element with an ID of #button123 but that element ID is different on each of the additional pages you're targeting, so the modifications won't be applied.
-If this is the case then you need to update the CSS selector in your modification in Visual Editor 

Avatar

Level 3

Hi,

Thanks for responding on this.

I did debug and found missing selector issue

varun790_0-1681359082651.png

template rule is working fine when I make changes on other content.

But our requirement is for header navigation and its not working for that case...

Structure is not getting changed as is the same header we are using for all the pages..

Header Structure remains the same. 

Avatar

Correct answer by
Employee Advisor

Ok, so if you take the CSS selector that's being used in the modification in Visual Editor, visit one of the pages where the change doesn't work, and use

document.querySelector('your-css-selector')

Does that return an element? I.e., it doesn't return null


Avatar

Community Advisor

@alexbishop I have the same issue. I made changes in the top navigation bar in VEC and the changes only show up on my home page which I used as an activity URL however I did apply the Template rule also like

Activity Location

OR any page where URL starts with https://www.amg.com 
 
I tried the below you suggested on the pages where the experience Is not coming up. It outputs null value in the console to me

document.querySelector('your-css-selector')

Can you suggest something?