Best Practices to Avoid GA tracking issue

From SVG Media

With advent of modern browsers, cookie based tracking is showing huge discrepancy in tracking the visits and subsequent conversions. This can be attributed to modern browsers not allowing execution of Java script or disablement of cookies on user’s browsers for user tracking and conversion/visit attribution.As a direct result publisher loses revenue and advertisers are unable to measure the true performance and ROI generated from a campaign. Both publishers and advertisers needs to do some altercations in their code to fix the issues.

What Publishers should do

What Advertisers should do

Snippet extracted from above link-
Alternative async tracking snippet
While the JavaScript tracking snippet described above ensures the script will be loaded and executed asynchronously on all browsers, it has the disadvantage of not allowing modern browsers to preload the script.
The alternative async tracking snippet below adds support for preloading, which will provide a small performance boost on modern browsers, but can degrade to synchronous loading and execution on IE 9 and older mobile browsers that do not recognize the async script attribute. Only use this tracking snippet if your visitors primarily use modern browsers to access your site.
<script>||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
<script async src=''>

Specifying different transport mechanisms snippet
By default, analytics.js picks the HTTP method and transport mechanism with which to optimally send hits. The three options are 'image' (using an Image object), 'xhr' (using an XMLHttpRequest object), or 'beacon'using the new navigator.sendBeacon method.
The former two methods share the problem described in the previous section (where hits are often not sent if the page is being unloaded). The navigator.sendBeacon method, by contrast, is a new HTML feature created to solve this problem.
If your user's browser supports the navigator.sendBeacon, you can specify 'beacon' as the transportmechanism and not have to worry about setting a hit callback.
The following code sets the transport mechanism to 'beacon' in browsers that support it.
• ga('create', 'UA-XXXXX-Y', 'auto');
// Updates the tracker to use `navigator.sendBeacon` if available.
ga('set', 'transport', 'beacon');
Currently, analytics.js only uses navigator.sendBeacon if the transport mechanism is set to 'beacon'. However, in the future, analytics.js will likely switch to using 'beacon' as the default mechanism in browsers that support it.

  • Tags should be inline
This one often comes back to bite many implementations. Golden rule: javascript tags should be inline. They should not be placed in delightful places such as inside tables or frames and such things. It will greatly impact your ability to collect data accurately.
  • Debugging in case of issues.
Google gives way of debugging issues at your end. Following links give more details-