pradeep
pradeep

Reputation: 45

Adobe DTM custom page Load rule

We have a website with multiple products. we are targeting pages with only one specific product. Now we need a page load rule that fires only if some text is present on the webpage or source code.

text- SSO OR SSU OR SSI.

can anyone help with Jquery or JAVASCRIPT CODE?

Upvotes: 0

Views: 62

Answers (1)

punkbit
punkbit

Reputation: 7717

The operation that you want to have is costly. You're searching for a "string" or "pattern match" and that requires you to check the whole document! My suggestion is, if there's any control over where that "string" is going to be place, than do it and operate only at that level (be specific to a small part of the page, not the whole page).

Otherwise, if you want to check the whole page for any string (I don't recommend it, but that's what you're asking), you can do:

(document.documentElement.textContent || document.documentElement.innerText).match(/SSO|SSU|SSI/).length > 0

Upvotes: 1

Related Questions