Custom script injection in MAZ Web app Custom script injection in MAZ Web app

Custom script injection in MAZ Web app

Vijay Sharma Vijay Sharma

Inject custom script in the header and footer of your MAZ web app to link tools like Facebook Pixel.

You can add custom script to the header or footer on MAZ Web app. For instance, you may want to add Facebook Pixel to track visitor activity on your MAZ Web which can be extremely useful if you are looking to measure the effectiveness of your ads, to define custom audiences for ad targeting, for dynamic ads campaigns, and to analyse the effectiveness of your website's conversion funnels.

NOTE: Any script that tries to change the UI of the app, for example showing a pop up for collection of user emails etc., might not work as expected due to the complex design elements of the Web app. This functionality if mainly designed for tools like Facebook Pixel.

How to add the scripts?

Step 1: Navigate to Content >> Channels >> Channel Setup and choose WEB from the drop down menu.


Step 2: In the WEB channel setup form, add the customer scripts to be placed in the header and footer of the WEB app, and save the form.

 

screencapture-dashboard-mazsystems-mazcontrol-combo-apps-3293-endpoints-setup-web-as-output-2021-09-14-14_19_47-png.png

Important Note:

A complete script should be placed in the provided text fields (with appropriate starting and closing tags), in the channel setup form.

 

Example Facebook Pixel script:

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '{your-pixel-id-goes-here}');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id={your-pixel-id-goes-here}&ev=PageView&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->

 

Where are the scripts added in the WEB app?

The script placed in the header text field, will be added before the closing head tag (</head>).

Screenshot 2021-09-14 at 2-38-45 PM-png.png

The script placed in the footer text field, will be added before the closing body tag (</body>).

Screenshot 2021-09-14 at 2-41-32 PM-png.png

Once the WEB channel setup form is saved, the changes will reflect in the live app within 5-10 minutes.

 

Know more about Facebook Pixel here.