From 2303c7acbfb3c3311272176c0586fcb807e64174 Mon Sep 17 00:00:00 2001 From: huyfei Date: Fri, 1 Mar 2024 17:00:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20dma=5Fgg=20?= =?UTF-8?q?=E5=8F=8D=E5=A4=8D=E4=B8=8A=E6=8A=A5=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?.=20=20=E5=BD=93=20tcf=20result=20=E5=80=BC=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E6=89=8D=E4=BC=9A=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E7=82=B9=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/Script/Consent/GoogleDMAHelper.cs | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs b/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs index 5b93cbd..51ab9db 100644 --- a/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs +++ b/Runtime/GuruConsent/Runtime/Script/Consent/GoogleDMAHelper.cs @@ -15,6 +15,8 @@ namespace Guru /// public class GoogleDMAHelper { + private static string Tag => GuruConsent.Tag; + public static readonly bool UsingDelayAppMeasurement = false; public static List PurposesRules = new List @@ -33,9 +35,12 @@ namespace Guru { "at", "be", "bg", "hr", "cy", "cz", "dk", "ee", "fi", "fr", "de", "el", "hu", "ie", "it", "lv", "lt", "lu", "mt", "nl", "pl", "pt", "ro", "sk", "si", "es", "se", "no", "is", "li" }; - - private static string Tag => GuruConsent.Tag; - + + private static string DmaResult + { + get => PlayerPrefs.GetString(nameof(DmaResult), ""); + set => PlayerPrefs.SetString(nameof(DmaResult), value); + } /// /// Set DMA status @@ -88,6 +93,21 @@ namespace Guru adjustThirdPartySharing.addGranularOption("google_dma", "ad_user_data", $"{result[3]}"); Adjust.trackThirdPartySharing(adjustThirdPartySharing); + //----------- Guru DMA report --------------- + ReportResult(purposeStr, result); + } + + + private static void ReportResult(string purposeStr, string result) + { + if (!string.IsNullOrEmpty(DmaResult) && DmaResult == result) + { + // result nochange will not report the event; + return; + } + + DmaResult = result; + //----------- Guru Analytics report --------------- Analytics.LogEvent("dma_gg", new Dictionary() { @@ -99,9 +119,9 @@ namespace Guru EnableFirebaseAnalytics = true, EnableFacebookAnalytics = true, }); - } + /// /// using Guru map rules to generate the result ///