[x] Assume GA has been setup independently from the plugin and don't send a page view with the gtag( 'config', ... ) call.
Describe the Approach
If this plugin is supposed to enhance the existing Analytics setup, we need to not send a page view when we call gtag( 'config', ... ).
The standard gtag implementation would instruct web administrators to paste the following snippet to the <head> of the site:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XXX');
</script>
The config call also by default sends a pageview.
This means when we make "our" config call later in the page lifecycle, we need to instruct gtag to not send a page view. That's what this PR does.
Note: Ultimately I wonder if there is a better way for us to apply "our" configuration. Maybe by using gtag( 'set' method or even altering the underlying dataLayer variable?
Fixes #46
Tasks
gtag( 'config', ... )
call.Describe the Approach
If this plugin is supposed to enhance the existing Analytics setup, we need to not send a page view when we call
gtag( 'config', ... )
.The standard
gtag
implementation would instruct web administrators to paste the following snippet to the<head>
of the site:The
config
call also by default sends a pageview.This means when we make "our"
config
call later in the page lifecycle, we need to instructgtag
to not send a page view. That's what this PR does.Note: Ultimately I wonder if there is a better way for us to apply "our" configuration. Maybe by using
gtag( 'set'
method or even altering the underlyingdataLayer
variable?