Legacy Knowledge Base
Published Jun. 30, 2025

Where can you create/use Analytics Cloud custom events in Liferay?

Written By

Rita Schaff

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • We want to send custom events to Analytics Cloud from our Liferay DXP instance.
  • How can we do this?

Environment

  • Liferay DXP
  • Analytics Cloud

Resolution

For everything else, you can use Custom Events by using any feature of Liferay that supports Javascript, such as

  • Pages' Javascript field
    Site Builder → Public Pages → Configuration ⚙ icon → Advanced tab → Javascript field
    Any script you enter here will be executed on all the Public pages whenever the page is displayed.
    Pages__JavaScript_field.png
  • Web Content Article with a script in the source
    1. Create a Web Content article with a structure that has a HTML field
    2. Change the view to the Source view
    3. Enter your script
    4. Publish the Web Content article
    5. Display it on a page
    6. Whenever the article is displayed, the script is called
    Web_Content_Source_Field.png
  • The Fragment's JavaScript field
    Design → Fragments → create a new fragment → JavaScript field
    Like web content articles, you need to display the fragment on a page to call the script.
    Fragment_JavaScript_Field.png

Having the script in the Page JavaScript field is generally the best option. However, using fragments or web content articles could work better depending on what you need.

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base