Journey Manager (JM) The transaction engine for the platform. | Platform Developer | 24.04This feature was updated in 24.04
Manager allows you to add third-party page tracking scripts to forms so you can track them in web analytics services, such as Google Analytics, Marketo and NetResults. You are not limited to these services only - you can add any other page tracking tags as long as you provide a valid custom JavaScript.
You can set up a form page tracking using one of following options:
To configure page tracking for a form:
GA4-XXXXX-X
with your Google Analytics account ID.MUNCHKIN_ACCOUNT_ID
with your Marketo account ID.<!-- Google Tag Manager -->
<noscript/noscript>
< script >(function(w,d,s,l,i){...});</script>
<!-- End Google Tag Manager -->
For example, you can add the following Google Analytics scrip to track your Maestro forms:
<!-- Google Tag Manager -->
<noscript/noscript>
<script>window.addEventListener('DOMContentLoaded', function(){
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXX');
});</script>
<!-- End Google Tag Manager -->
However, you can't add an input tag HTML element within the body tag, such as the one shown below:
<input type="hidden" name="formCode" id="submission_formCode" value="$form.formCode"/>
Although, you can add it into the actual Maestro form as the HTML element into a static text component label.
For more information, see how to add Google Tag Manager support.
Also, in some instances, you can use this functionality to load external JavaScript libraries in a form.
The Journey Manager SDK provides the pageTrackingIncludePosition
and pageTrackingScriptFile
attributes, which you define in the form-def.json
file, to configure page tracking in a form.
For example, add the "pageTrackingIncludePosition": "Inside HEAD"
and "pageTrackingScriptFile": "./page-tracking.jsp"
to place the script defined in ./page-tracking.jsp
inside the <head>
element of the HTML markup. For more information, see Form JSON Definitions.
The Journey Manager allows you to configure page tracking in a form using the Configuration Service. For each form, identified with formCode
, add the pageTrackingEnabledFlag
, pageTrackingIncludePosition
, and pageTrackingContent
attributes to the configuration-service.json
file. The pageTrackingContent
attribute holds the content of the JavaScript file specified in pageTrackingScriptFile
.
The snippet of the JSON file is shown below:
"formDetails" : [
{
"formCode":"MyForm",
"pageTrackingEnabledFlag": "true",
"pageTrackingIncludePosition": "Inside HEAD",
"pageTrackingContent": "#* Page Tracking Content Velocity Template Parameters.\n Note the $submission and $formDataMap parameters will be added only to pages after the form submission. \n Please replace 'GA4-XXXXX-X' with you Google Analytics account ID.\n \n $form: com.avoka.fc.core.entity.Form\n $request: jakarta.servlet.http.HttpServletRequest\n $requestParams: Map<String, String>\n $requestCookies: Map<String, String>\n $requestURL: String\n $submission: com.avoka.fc.core.entity.Submission\n $formDataMap: Map<String, String>\n*#\n<script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', 'GA4-XXXXX-X']);\n _gaq.push(['_trackPageview']);\n\n (function() {\n var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n })();\n</script>"
},
{...}
],
Next, learn how to assign form spaces to a form.