Comment on page

Google Analytics

Get valuable insights in Google Analytics by integrating Zipy session URLs for user session tracking.

Step 1: Add Code to Your Website

To send the Zipy session URL to Google Analytics, add the following code snippet to your website. This code uses the gtag.js API to send a custom event with the event name 'zipy_event'. The Zipy session URL is included as a parameter with the key 'zipy_session_url' in the event payload.
gtag('event', 'zipy_event', {
'zipy_session_url': window.zipy.getCurrentSessionURL()

Step 2: Trigger the Event on User Action (Optional)

If you want to send the Zipy session URL based on a specific user action, such as a button click or when an error occurs, you can add additional JavaScript code to trigger the event. For example, to send the Zipy session URL when an error occurs, you can use the window.onerror event handler:
window.onerror = (error) => {
gtag('event', 'zipy_event', {
'error': error,
'zipy_session_url': window.zipy.getCurrentSessionURL()

Step 3: Verify Event in Google Analytics

After completing the integration steps, you can verify the event in your Google Analytics dashboard. Log in to your Google Analytics account, navigate to the appropriate property, and go to the "Events" section. Look for the 'zipy_event' in the list of events. You should see the Zipy session URL data associated with the event, providing insights into user sessions.
For more information on sending events to Google Analytics and analyzing event data, you can refer to the following link: Link to Google Analytics documentation on sending events