Yext offers the ability to integrate with third-party analytics providers to visualize analytics. These metrics will only be visible to users via the third-party vendor’s platform and will not feed into Yext Analytics.
Most analytics scripts will need to be loaded on every page on your site. You can add them globally by using the Header HTML section in the settings of your page builder template.
To integrate a third-party analytics provider into Page Builder:
- Click Pages in the navigation bar and click All Sites.
- Click Edit next to the Site you would like to add the third-party analytics provider to.
- Click Edit next to the Template you would like to add custom markup to.
- Click Settings in the sidebar.
- Click Header HTML. This will open a Code Editor.
- You can click Expand Editor to give yourself more space.
- In the code editor, add the relevant script.
- Click Save.
Google Analytics
To add Google Analytics, add the following script to your Header HTML, replacing `UA-XXXXX-Y` with your Google Analytics ID. More instructions can be found here.
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
Google Tag Manager
If you are using Google Tag Manager, add the following script to your Header HTML, replacing `GTM-XXXX` with your container ID. More instructions can be found here.
<!-- Google Tag Manager -->
<script>(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-XXXX');</script>
<!-- End Google Tag Manager -->
Other Analytics Providers
If your analytics provider has provided a script to add to your page's `<head>` tag, you can insert this HTML in the same Header HTML section.