migrating from analytics.js to gtag.js

2019-06-13 05:29发布

问题:

How would you migrate a ga create command that uses the allowLinker and siteSpeedSampleRate parameters to the gtag config command?

ga('create' 'UA-1234567-25', 'auto', {'allowLinker': true,'siteSpeedSampleRate': 100 });

回答1:

"linker" will allow you to accept incoming cross domain. "site_speed_sample_rate" will allow you to adjust the site speed sampling rate.

  gtag('config', 'UA-1234567-25', 
    {
      'linker': {'accept_incoming': true},
      'site_speed_sample_rate': 100
    });