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

Adding more documentation about Google Analytics template #1654

Closed
digitalcraftsman opened this issue Dec 1, 2015 · 14 comments
Closed

Adding more documentation about Google Analytics template #1654

digitalcraftsman opened this issue Dec 1, 2015 · 14 comments

Comments

@digitalcraftsman
Copy link
Member

I've recognized that the docs are missing an example of the built-in Google Analytics template and of the corresponding variable for the config file.

What would be a good place to insert them into the docs? Furthermore, the docs provide an example of a footer partial taken from the code of spf13.com.

Should I remove the GA part of this example?

/cc @anthonyfok @bep

@cfjedimaster
Copy link

Dumb question - but where exactly is this documented? I've been looking for a while now and can't find it.

@cfjedimaster
Copy link

Site variables (https://gohugo.io/templates/variables/), mentions .Site.GoogleAnalytics and says this:

"A string representing your tracking code for Google Analytics as defined in the site configuration."

Ok, so I go to configuration (https://gohugo.io/overview/configuration/) but I see nothing there.

@digitalcraftsman
Copy link
Member Author

Hello @cfjedimaster,

I've integrated this feature shortly before the release of Hugo v0.15. But this didn't included the documentation. Since a while I'm waiting for feedback to add it.

However, you can enable the internal Google Analytics template by adding the following line to your theme:

{{ template "_internal/google_analytics.html" . }}

Now, move to the config file and assign your tracking code to the corresponding variable:

googleAnalytics = ""

The template behaves similar to the one of Disqus. If googleAnalytics is not set or equals an empty string the internal template will not appear in your generated sites.

@cfjedimaster
Copy link

Thanks. Should the bug be reopened though?

@digitalcraftsman
Copy link
Member Author

Which bug do you mean?

@cfjedimaster
Copy link

Well, it says, "I've recognized that the docs are missing an example of the built-in Google Analytics template.", and I guess I saw this as related, but maybe a new bug should be filed for the variable?

@digitalcraftsman
Copy link
Member Author

Now, I understand what you mean. I've updated the first comment and mentioned the config variable explicitly.

but maybe a new bug should be filed for the variable

Both things are closely related. Therefore, I would keep them together in a single issue.

@cfjedimaster
Copy link

Cool, and thank you for the help.

On Fri, Jan 15, 2016 at 3:17 PM, digitalcraftsman notifications@github.com
wrote:

Now, I understand. I've updated the first comment and mentioned the config
variable explicitly.

but maybe a new bug should be filed for the variable

Both things are closely related. Therefore, I would keep them together in
a single issue.


Reply to this email directly or view it on GitHub
#1654 (comment).

Raymond Camden, Developer Advocate for MobileFirst at IBM

Email : raymondcamden@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

@dherbst
Copy link
Contributor

dherbst commented Feb 8, 2016

I added pull request #1829, does this satisfy the documentation requirement?

@digitalcraftsman
Copy link
Member Author

Hello @dherbst,

your commit seems to be fine. A new page in the extras-section is reasonable. I would have written the docs myself but I didn't got feedback about a location so far.

I would merge your commit if nobody has something to complain. @bep, @anthonyfok: do you agree?

@anthonyfok
Copy link
Member

Looks good to me, @digitalcraftsman! Just make sure you change "Adds" to "Add" in the commit message. <grin, duck, run>

@soaxelbrooke
Copy link

Newcomer to hugo here, and I'm not able to get this working with the existing documentation. Is it out of date?

@soaxelbrooke
Copy link

For those that stumble on this, I was helped by this example footer.html, where you just replace the literal UA value with {{ .Site.GoogleAnalytics }}, after you've set googleAnalytics = "UA-0000000-00" in your config.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants