Custom script use case: enabling Google Analytics in IPF

Follow these steps to run custom JavaScript on all pages in an Infor Portal Foundation (IPF) portal by adding code in a Custom.js file. In this example, we are enabling Google Analytics in IPF.

  1. Create a file named Custom.js.
  2. Follow the steps in the "Set up Analytics tracking" topic on this Google Analytics page: https://support.google.com/analytics/answer/1008080. This task generates a tracking ID for a tracking code snippet provided by Google Analytics. You do not need to add the code snippet to each portal page. You will add it to the Custom.js file instead.
  3. Add the tracking code snippet, including your specific tracking ID, to your Custom.js file.

    This is a sample tracking code snippet. Be sure to use the one provided by Google Analytics, in case it has been updated.

    $('head').append('<!-- Global Site Tag (gtag.js) - Google Analytics --> \
    <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> \
    <script> \
      window.dataLayer = window.dataLayer || []; \
      function gtag(){dataLayer.push(arguments);} \
      gtag(\'js\', new Date()); \
      gtag(\'config\', \'GA_TRACKING_ID\'); \
    </script>');
  4. In the Portal Manager, drag and drop this file into All Components > Assets > Scripts. This creates a custom version of the file in the active originator. The original version of the file is empty, so only desired customizations must be included in your Custom.js file.