Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Add options for Google Analytics #58

Merged
merged 3 commits into from
Apr 2, 2015
Merged

Add options for Google Analytics #58

merged 3 commits into from
Apr 2, 2015

Conversation

QWp6t
Copy link
Member

@QWp6t QWp6t commented Mar 15, 2015

add_theme_support('soil-google-analytics', 'UA-XXXXXX');

By default, the script will be loaded from the wp_footer hook, but you can specify any other action hook as the third parameter.

add_theme_support('soil-google-analytics', 'UA-XXXXXX', 'wp_head'); // script will load during wp_head

I also changed the way the filter works. Instead of the filter being soil/displayGA, it's now soil/dummyGA and returning true will use the dummy ga() function while false will load H5BP's snippet.

add_filter('soil/dummyGA', '__return_false'); // Appends H5BP's GA snippet
```


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👮 remove one of these lines

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's basically the same as what's already in the README for that part:

https://github.com/roots/soil#google-analytics

Note that I have the filter there twice as well with the comments on the right.

I don't mind removing one, but I left it there so that it would clarify exactly what true and false mean in the filter.

@QWp6t QWp6t force-pushed the QWp6t-optionsGA branch from 05fca06 to f4a0b6d Compare March 16, 2015 04:24
*/
function google_analytics() {
if (!defined('GOOGLE_ANALYTICS_ID') || !GOOGLE_ANALYTICS_ID) {
list($ga_id, $hook) = $options + ['','wp_footer'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after comma?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yee

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dun

@QWp6t QWp6t force-pushed the QWp6t-optionsGA branch from f4a0b6d to 8443193 Compare March 18, 2015 06:37
@swalkinshaw
Copy link
Member

My feedback for some readability tweaks: https://gist.github.com/swalkinshaw/ff3b45c4bf164a3d4573

@swalkinshaw
Copy link
Member

👍

@QWp6t QWp6t force-pushed the QWp6t-optionsGA branch from 8beab05 to fd0f221 Compare March 21, 2015 02:02
if (isset(self::$modules[$module])) {
return self::$modules[$module]->options;
}
if (substr($module, 0, 5)!=='soil-') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have triggered a fail on phpcs :(

@retlehs
Copy link
Member

retlehs commented Apr 1, 2015

will merge after it passes after the latest phpcs change (#60)

retlehs added a commit that referenced this pull request Apr 2, 2015
Add options for Google Analytics
@retlehs retlehs merged commit ea351c0 into master Apr 2, 2015
@retlehs retlehs deleted the QWp6t-optionsGA branch April 2, 2015 15:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants