Skip to main content
Tangiblee
 > 
Help Center
 > 
 > 
Analytics Setup for Self-Service Integration - Migration to GA4

Analytics Setup for Self-Service Integration - Migration to GA4

On July 1, 2023, standard Universal Analytics properties will stop processing data, according to Google Analytics Support. To complete the GA4 migration, some actions may be required, such as removing or adding some code.

GA3

Please find the analytics integration document for integrating GA3 with the old snippet example.

Before switching to GA4, the following code section was used to collect data in GA3 (Universal Analytics).

<script>
window.tangibleeAnalytics('setAnalyticsPlugin', 'GoogleAnalytics', {
	trackingId: 'UA-XXXXXXXX-01',
	ecommerceTracking: false
});
window.tangibleeAnalytics('setAnalyticsPlugin', 'GoogleAnalytics', {
	trackingId: 'UA-XXXXXXXX-02',
	inPageAnalytics: true,
	trackerName: '',
	useCustomerTrackingId: false,
	ecommerceTracking: false,
	customTangibleeDimension: 16,
	customWidgetDimension: 17,
	customWidgetSessionDimension: 18,
	customTangibleeSessionDimension: 19,
	customTangibleeUserDimension: 20
});
<script> 

Migration to GA 4

To switch to GA4, please, follow these steps:

  1. Remove the code section that collects data for GA3 (code example is indicated above).
  2. Add the following code to replace the removed one.

tangiblee('onGoogleAnalyticsIsReady', function(trackingId, analyticsSettings) {
    window.tangibleeAnalytics =
        window.tangibleeAnalytics ||
        function() {
            (window.tangibleeAnalytics.q = window.tangibleeAnalytics.q || []).push(arguments);
        };
    if(analyticsSettings.sendGAEventsViaInfoPortal === true) {
				//Collection of GA4 analytics for Tangiblee
        window.tangibleeAnalytics('setAnalyticsPlugin', 'InfoPortalAnalyticsForGA4', {
            trackingId: analyticsSettings.tangibleeMeasurementId,
        });
    }
    if(analyticsSettings.sendGAEventsDirectly === true) {
				//Collection of GA4 analytics for Tangiblee
        window.tangibleeAnalytics('setAnalyticsPlugin', 'GoogleAnalytics4', {
            trackingId: analyticsSettings.tangibleeMeasurementId,
        });
				//Your GA4 analytics
        analyticsSettings.clientMeasurementId && window.tangibleeAnalytics('setAnalyticsPlugin', 'GoogleAnalytics4', {
            trackingId: analyticsSettings.clientMeasurementId,
            currentDataLayerName: analyticsSettings.clientDataLayerName,
            isCustomerGA: true,
						/* If you are using GTM to collect analytics, you will need to unmute this config
						gtmConfig: { 
                enabled: true,
                events: {
                    impressed: 'tng_impressed',
                    interacted: 'tng_interacted'
                }
            }*/
        });
    }
});

References

Analytics Setup - Overview

Related Articles