private void CheckForGoogleClientId(string eventName, string data, bool shouldUpdate) { try { if (eventName == FeatureAnalyticsConstants.Events.UpdateGoogleCidLocal && !string.IsNullOrWhiteSpace(data)) { IGoogleClientIdentifier googleContactIdentifier = Tracker.Current.Contact.GetFacet <IGoogleClientIdentifier>("Cid"); if (string.IsNullOrWhiteSpace(googleContactIdentifier.Cid)) { googleContactIdentifier.Cid = data; Tracker.Current.Session.Identify(data); } // Only perform the update if requested and the current recorded CID is empty or matches the cid being passed in. var doesGoogleIdentifierMatch = string.IsNullOrWhiteSpace(googleContactIdentifier.Cid) || googleContactIdentifier.Cid == data; if (shouldUpdate && doesGoogleIdentifierMatch) { SetPersonalDetails(data); } } } catch (Exception ex) { Sitecore.Diagnostics.Log.Error("Could not indentify user and enroll in checkout campaign", ex); } }
private void UpdateGoogleCid(Contact contact, RegisterPageEventArgs args) { try { IGoogleClientIdentifier googleContactIdentifier = contact.GetFacet <IGoogleClientIdentifier>("Cid"); googleContactIdentifier.Cid = args.EventParameters.Data; Tracker.Current.Session.Identify(args.EventParameters.Data); CampaignItem item = new CampaignItem(Sitecore.Context.Database.GetItem(ID.NewID)); Sitecore.Analytics.Tracker.Current.CurrentPage.TriggerCampaign(item); } catch (Exception ex) { Sitecore.Diagnostics.Log.Error("Could not indentify user and enrol in checkout campaign", ex); } }