Continuing User Tracking Across Devices in GTM with Email Authentication and _ga Parameters

I’m currently using Google Tag Manager (GTM) to track user activities on my site. However, I’ve encountered an issue with tracking continuity when users authenticate their email addresses on a different device. It seems that the tracking stops once the user switches devices during the email verification process.

From what I understand, including the _ga parameter in the authentication URL within the email can help maintain the tracking continuity. However, I’m unsure how to effectively retrieve the _ga parameter from cookies and append it to the authentication URL.

Can anyone provide guidance or examples on how to extract the _ga parameter from cookies and incorporate it into the email authentication URL? This way, I can ensure consistent tracking even when users complete the email verification on a different device.

Any insights or tips on this would be greatly appreciated. Thank you!