Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor gatsby-plugin-google-analytics gatsby-browser.js #14572

Merged
merged 1 commit into from
Jun 10, 2019

Conversation

BPScott
Copy link
Contributor

@BPScott BPScott commented Jun 5, 2019

Description

The gatsby-browser.js file in gatsby-plugin-google-analytics and
gatsby-plugin-google-gtag have borderline identical functionality howeve
that is slightly obscured as their implementation is slightly different,
notably gatsby-plugin-google-analytics does not use the early return
pattern which means the nesting of everything is different if you try
and diff the two files.

This commit makes gatsby-plugin-google-analytics use the early return
pattern to make it applying the same changes to this an
gatsby-plugin-google-gtag easier.

Run diff -u packages/gatsby-plugin-google-analytics/src/gatsby-browser.js packages/gatsby-plugin-google-gtag/src/gatsby-browser.js to see that the contents is now nearly identical

The gatsby-browser.js file in gatsby-plugin-google-analytics and
gatsby-plugin-google-gtag have borderline identical functionality howeve
that is slightly obscured as their implementation is slightly different,
notably gatsby-plugin-google-analytics does not use the early return
pattern which means the nesting of everything is different if you try
and diff the two files.

This commit makes gatsby-plugin-google-analytics use the early return
pattern to make it applying the same changes to this an
gatsby-plugin-google-gtag easier.
@freiksenet freiksenet merged commit 9f2c0c9 into master Jun 10, 2019
@freiksenet
Copy link
Contributor

Thank you!

@BPScott BPScott deleted the standardize-analytics branch June 10, 2019 16:24
mxxk pushed a commit to mxxk/gatsby that referenced this pull request Jun 21, 2019
…alytics gatsby-browser.js (gatsbyjs#14572)

The gatsby-browser.js file in gatsby-plugin-google-analytics and
gatsby-plugin-google-gtag have borderline identical functionality howeve
that is slightly obscured as their implementation is slightly different,
notably gatsby-plugin-google-analytics does not use the early return
pattern which means the nesting of everything is different if you try
and diff the two files.

This commit makes gatsby-plugin-google-analytics use the early return
pattern to make it applying the same changes to this an
gatsby-plugin-google-gtag easier.
johno pushed a commit to johno/gatsby that referenced this pull request Jul 17, 2019
…alytics gatsby-browser.js (gatsbyjs#14572)

The gatsby-browser.js file in gatsby-plugin-google-analytics and
gatsby-plugin-google-gtag have borderline identical functionality howeve
that is slightly obscured as their implementation is slightly different,
notably gatsby-plugin-google-analytics does not use the early return
pattern which means the nesting of everything is different if you try
and diff the two files.

This commit makes gatsby-plugin-google-analytics use the early return
pattern to make it applying the same changes to this an
gatsby-plugin-google-gtag easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants