[GA4] Set up cross-domain measurement - Analytics Help
文章推薦指數: 80 %
Verify that the URL in the destination domain contains the linker parameter _gl ; for example: https://www.example.com/?_gl=1*abcde5* . Troubleshooting. If you ...
Skiptomaincontent[GA4]Setupcross-domainmeasurementThisarticleisforwebsiteownerswhoneedunifiedmeasurementacrossmorethanonedomain,e.g.acrossacustomerwebsiteandaseparateshoppingcartdomain.ThisarticlepertainstoGoogleAnalytics4properties;ifyouareusingUniversalAnalytics,readthisarticleinstead.
Cross-domainmeasurementallowsactivitytobeaccuratelyattributedtoasingleuserastheycrossdomains.Outboundclicksthatwouldordinarilytriggeraneventvia enhancedmeasurementareignoredwhentheoutboundlink leadstoadomainthatyou'velistedaspartofcross-domainmeasurement.
Videooverview
CrossDomainMeasurementinGoogleAnalytics4Properties
Cookiesandcross-domainmeasurement
Analyticsusesfirst-partycookiestosetanidentifierforeachuniqueuserandsessiontoawebsite.
Withoutcross-domainmeasurement,newcookieswithnewidentifiersaresetforeachdomainauservisits.Analyticscountthesenewcookieswithnewidentifiers asseparateuserswithseparatesessions.
Withcross-domainmeasurement,thesameidentifiersarepassed fromonesitetoanotherviaaURLparameteridentifiedbythekey_gl:,forexample:https://www.example.com/?_gl=1*abcde5*.
Ifyoualsohavea UniversalAnalyticsproperty
ForyourUniversalAnalyticsproperty,youconfiguredcross-domainmeasurement viacode (eitherinthesourcecodethroughanalytics.jsorgtag.js,orviaGoogleTagManager).Foryour GoogleAnalytics4property,you'lldothisviatheAdminpage.Follow theinstructionsbelowtoaddthesamedomainsyou'veidentifiedinyourUniversalAnalyticspagecode.
IfyouhaveanexistingconfigurationintheGoogletagforyourUniversalAnalyticsproperty,itwillbeappliedtoyourGoogleAnalytics4propertyaswell.Anydomainsyou'vespecifiedin thecodeorviathe Admin willapplytoyourGoogleAnalytics4property.However,werecommendthatyouconfigureintheAdmin only.
Setupcross-domainmeasurementviatheAdmin
YouneedtheEditorroletosetupcross-domainmeasurement.
Checkyourtag(e.g.theGoogletagoneachof yourHTML pages)foreachdomainthatyouwanttoincludeinyourcross-domainmeasurement.Thetagoneachpagemustuse thesametagID(i.e.,thesame"G-"ID)fromthesamewebdatastream.
InAdmin,click DataStreams inthe Property column.
Click Web andthenclickawebdatastream.
Inthewebstreamdetails,click Configuretagsettings (atthebottom).
Inthe Settings section,click Configureyourdomains.
UnderIncludedomainsthatmatchANYofthefollowingconditions:
Chooseamatchtype.
UnderDomain,entertheidentifierforthedomainyouwanttomatch(e.g.,example.com).
ClickAddconditiontoaddthenextdomain.(Addeachdomainyouwanttoincludeincross-domainmeasurement.)
ConditionsareevaluatedusingORlogic.
ClickSave.
Manualsetup
Therecommendedapproachistoconfigurecross-domainmeasurementviatheAnalyticsinterface.However,theremightbescenarioswhereyouneedtoimplementacustomsolutionviathemeasurementcode.Inthesecases,youcansetitupmanuallybyusingthegetandsetcommandsofthegtag.jsAPItopersistIDsacrossdomains.Learnmoreaboutsettingupcross-domainmeasurementmanually.
Example
ToretrieveaclientIDonthesourcedomain,youusethegetmethod:
gtag('get','TAG_ID','client_id',(client_id)=>{
//StoretheclientIDinavariable.
});
gtag('get','TAG_ID','session_id',(session_id)=>{
//StorethesessionIDinavariable.
});
OnceyouhavetheclientandsessionIDs,addthemtothelinkthatpointstothedestinationdomain:
延伸文章資訊
- 1AMP Linker for Google Analytics adding _gl query param to ...
That's not good because every time the admin bar menu item is clicked, a separate validated URL p...
- 2GTMTips: Cross-domain Tracking In Google Analytics 4
js or Google Tag Manager which would allow us to generate the linker parameter (the one with the ...
- 3Cross-Domain Tracking on Google Analytics 4 (GA4)
This function takes an object of clientIds values as an argument and returns a valid " _gl " link...
- 4Measure activity across multiple domains | Tags
Cross-domain measurement with Google tags will add a linker parameter to ... The linker parameter...
- 5The importance of _gl parameter for cross domai...anycodings
The importance of _gl parameter for cross domain tracking when you have Google Analytics installe...