Custom Coding

Note: This feature is currently released under our Controlled Availability program. To request access to this feature, please log in to My Oracle Support and create a service request. Availability for this feature is specific to product trim. Contact your account representative for more information.

Setting up reusable code

To establish reusable code, simply create a Web personalization and set up content to run for all visitors.

There are two things to take into consideration:

  1. Web personalizations run in alphabetical order on the web page.

  2. There’s a JavaScript name space shared across scripts.

Web personalizations run in alphabetical order on the web page.

If you want some code you put under content to run before anything else from other personalizations, just give your personalization a name that would go first alphabetically.

For instance, your scripts personalization might be named

  • G01 Global Scripts

While ordinary personalizations can go as

  • P01 Homepage Banner

  • P02 …

  • P03 …

That should make all the functions defined under “G01 Global Scripts” immediately available in any other personalization.

There’s a JavaScript name space shared across scripts.

Each content runs in its own scope, so local variables would only be available wherever you define those.

To define a method or property for all content that runs on a page, set a reference to it in data.global object.

Example

data.global.cookie = function(name, value, expires) {};

Learn more

Web Personalization Canvas

Content Split

Cookie Component

Render Content into an HTML Element