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

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

Este artigo foi útil?
Utilizadores que acharam útil: 0 de 0