Code Samples for Third-Party Analytics Integrations
You can use these sample code snippets with a variety of common third-party analytics vendors. While you can likely copy and paste these code examples following the steps in Configure a Custom Third-Party Analytics Report, note the modifications in some sections.
You may need to further customize a code sample to meet your individual needs. Submit a support ticket using the if you need troubleshooting assistance.
If you use Google tag (gtag.js) and need to customize your integration, use one of these code samples in the code editor in step 6 of Creating the Custom Report.
Google Analytics 4 with Google Tag
Use this code if you've transitioned to Google Analytics 4 and the Google tag (gtag.js), formerly called the global site tag.
This code requires no special modifications.
Google Analytics 4 with Google Tag (Minimal)
This code is the most basic one for implementing Google Analytics 4 and the Google tag (gtag.js), formerly called the global site tag.
Google Analytics 4 with Universal Analytics Compatibility
Use this code if you have already created a GA4 property but are still using Universal Analytics for reports.
On July 1, 2023, Google's standard Universal Analytics properties stopped processing data.
If you use Adobe Analytics (formerly SiteCatalyst) and need to customize your integration, use one of these code samples in the code editor in step 6 of Creating the Custom Report. See Adobe Analytics' documentation for more information about the tl() method.
Adobe Analytics with s.tl
This report code sends a track link to Adobe Analytics with the experiences that the site visitor saw. Because Adobe Analytics has limits and bills according to the number of server requests, this track line reporting may impact a client's contact with Adobe Analytics.
Because of how Adobe Analytics tracks bounce rate, this track line reporting affects the bounce rate analytics. To avoid this, use the code sample without s.tl instead.
Follow these steps to modify the code sample for your integration:
- Replace the value of the varKey variable with the specific eVar or listVar to which labels should be sent.
- Replace the value of the opt_accountId variable with the name of the report suite to which labels should be sent. To find this name, look at the window variable s_i_xyz where xyz is the unique report suite name.
Adobe Analytics Without s.tl
This report code doesn't directly send labels to Adobe Analytics. Instead, it's a generic one to store the information that would be reported in a cookie. It's especially useful for Adobe Analytics to avoid sending a track link that can adversely affect bounce rate metrics in Adobe Analytics.
With this solution additional development is required on site to implement code that would take the information from the cookie and send it to the analytics provider however desired. It is usually delayed one-page load as the site usually reads the cookie at page load. The site is also responsible of clearing this cookie after the information is used.
IBM Coremetrics
This standard integration sends report labels as a conversion event and requires no modifications.
Clicktale
This standard integration requires no modifications.
FullStory
This standard integration requires no modifications.
Glassbox
This standard integration requires no modifications.
Mixpanel
This code sample is a typical method for sending experience information to Mixpanel.
New Relic
This standard integration requires no modifications.
Session Cam
This standard integration requires no modifications.