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

Commit

Permalink
Merge pull request #359 from rstudio/356-google-analytics
Browse files Browse the repository at this point in the history
Update to GA4
  • Loading branch information
whimsicallyson authored Mar 21, 2023
2 parents 1ea734d + 2833b14 commit 03bcfbf
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Connect](https://www.posit.co/products/enterprise/connect/).

# Documentation

See the documentation [on GitHub](docs/docs/index.md) or on [docs.rstudio.com](https://docs.rstudio.com/rsconnect-jupyter/).
See the documentation [on GitHub](docs/docs/index.md) or on [docs.posit.co](https://docs.posit.co/rsconnect-jupyter/).
2 changes: 1 addition & 1 deletion doc.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// The pipeline in this file syncs documentation from the project's s3 bucket to
// docs.rstudio.com where documentation is publicly visible. This pipeline
// docs.posit.co where documentation is publicly visible. This pipeline
// should be manually triggered on Jenkins when a release is cut.
pipeline {
agent { node('docker') }
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/additional.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

User Guide resources:

- [API Keys](http://docs.rstudio.com/connect/user/api-keys)
- [Jupyter Notebooks](https://docs.rstudio.com/connect/user/#jupyter-notebooks)
- [Publishing for the first time](https://docs.rstudio.com/connect/user/git-backed/#git-backed-publishing)
- [API Keys](http://docs.posit.co/connect/user/api-keys)
- [Jupyter Notebooks](https://docs.posit.co/connect/user/publishing-notebook/)
- [Publishing for the first time](https://docs.posit.co/connect/user/git-backed/#git-backed-publishing)

How-to Guide:

- For a step-by-step guide for creating and publishing a new Jupyter Notebook to
Posit Connect, view our [How To Publish a Jupyter Notebook to Posit Connect](https://docs.rstudio.com/how-to-guides/users/basic/publish-jupyter-notebook/).
Posit Connect, view our [How To Publish a Jupyter Notebook to Posit Connect](https://docs.posit.co/how-to-guides/users/basic/publish-jupyter-notebook/).

Video tutorial:

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/collaboration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ content location to publish to if the notebook title is the same.

Additionally, you may share notebooks if appropriate.

For additional information, please see the [Collaboration](https://docs.rstudio.com/connect/user/publishing/#publishing-collaboration) section of the Posit Connect User Guide.
For additional information, please see the [Collaboration](https://docs.posit.co/connect/user/publishing/#publishing-collaboration) section of the Posit Connect User Guide.
4 changes: 2 additions & 2 deletions docs/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ to publish the current notebook to Posit Connect.
- If this is your first time publishing a notebook, you will be
prompted to enter the location and a nickname for the Posit Connect server.
- You will also be prompted to enter your API Key. See the [Posit Connect User
Guide](http://docs.rstudio.com/connect/user/api-keys) for
Guide](http://docs.posit.co/connect/user/api-keys) for
instructions on generating API Keys for your user.
- When you click the **Add Server** button, `rsconnect-jupyter` will send a request to the Posit Connect server to verify that it can be reached via the requested URL and that the API key is valid.

Expand Down Expand Up @@ -123,7 +123,7 @@ informing you of this fact. If you need to regenerate the files, delete them in
<img class="border" src="../images/git-backed.png" class="block" alt="Dialog titled "Create Manifest" explaining the manifest creation process with "Cancel" and "Create Manifest" options">

For more information on git publishing, see the
[Posit Connect User Guide](https://docs.rstudio.com/connect/user/git-backed#git-backed-publishing).
[Posit Connect User Guide](https://docs.posit.co/connect/user/git-backed#git-backed-publishing).

## Handling conflicts

Expand Down
2 changes: 1 addition & 1 deletion docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ copyright: Posit Software, PBC. All Rights Reserved
#
# See overrides/partials/integrations/analytics.html
google_analytics:
- 'UA-20375833-3'
- 'GTM-KHBDBW7'
- 'auto'

nav:
Expand Down
5 changes: 1 addition & 4 deletions docs/overrides/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{#-
This file was automatically generated - do not edit
-#}
{% set site_url = config.site_url | d(nav.homepage.url, true) | url %}
{% if not config.use_directory_urls and site_url[0] == site_url[-1] == "." %}
{% set site_url = site_url ~ "/index.html" %}
Expand Down Expand Up @@ -84,7 +81,7 @@
<div class="md-flex__cell md-flex__cell--shrink left-nav">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="{{ base_url }}/../news/" title="Release Notes" class="md-tabs__link md-source">Release Notes</a></li>
<li class="md-tabs__item"><a href="https://support.rstudio.com/hc/en-us" title="Posit Support" class="md-tabs__link md-source">Help</a></li>
<li class="md-tabs__item"><a href="https://support.posit.co/hc/en-us" title="Posit Support" class="md-tabs__link md-source">Help</a></li>
<li class="md-tabs__item"><a href="https://www.posit.co/" title="Posit" class="md-tabs__link md-source logo"></a></li>
</ul>
</div>
Expand Down
66 changes: 37 additions & 29 deletions docs/overrides/partials/integrations/analytics.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
{% set analytics = config.google_analytics %}
{% set property = config.google_analytics %}
<!-- Google Analytics 4 (G-XXXXXXXXXX) -->
<script>
/* Use GA when hosted by our public docs site, not when installed. */
if (location.href.indexOf("docs.rstudio.com") >= 0) {
window.ga = window.ga || function() {
(ga.q = ga.q || []).push(arguments)
}
ga.l = +new Date
/* Use GA when hosted by our public docs site, not when installed. */
if (location.href.indexOf("docs.posit.co") >= 0) {
window.dataLayer = window.dataLayer || []
function gtag() { dataLayer.push(arguments) }
/* Set up integration and send page view */
gtag("js", new Date())
gtag("config", "{{ property[0] }}")

/* Setup integration and send page view */
ga("create", "{{ analytics[0] }}", "{{ analytics[1] }}")
ga("set", "anonymizeIp", true)
ga("send", "pageview")
/* Register virtual event handlers */
document.addEventListener("DOMContentLoaded", function () {
if (document.forms.search) {
var query = document.forms.search.query
query.addEventListener("blur", function () {
if (this.value) {
gtag("event", "search", { search_term: this.value })
}
})
}

/* Register handler to log search on blur */
document.addEventListener("DOMContentLoaded", function() {
if (document.forms.search) {
var query = document.forms.search.query
query.addEventListener("blur", function() {
if (this.value) {
var path = document.location.pathname;
ga("send", "pageview", path + "?q=" + this.value)
}
})
}
})
var s = document.createElement("script")
s.type = "text/javascript"
s.src = "https://www.google-analytics.com/analytics.js"
s.async = true
document.getElementsByTagName('head')[0].appendChild(s)
}
/* Send page view on location change */
if (typeof location$ !== "undefined")
location$.subscribe(function (url) {
gtag("config", "{{ property[0] }}", {
page_path: url.pathname
})
})
})
/* Create script tag */
var script = document.createElement("script")
script.async = true
script.src = "https://www.googletagmanager.com/gtag/js?id={{ property[0] }}"

/* Inject script tag */
var container = document.getElementsByTagName("head")[0]
var firstChild = container.firstChild
container.insertBefore(script, firstChild)
}
</script>
8 changes: 4 additions & 4 deletions rsconnect_jupyter/static/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ define([
'The javascript extension version reports ' + info.js_version + ' but the server ' +
'extension reports ' + info.rsconnect_jupyter_server_extension + '.<br />' +
'<ul>' +
'<li>Refer to the <a href="https://docs.rstudio.com/rsconnect-jupyter/#installation">' +
'<li>Refer to the <a href="https://docs.posit.co/rsconnect-jupyter/#installation">' +
'installation instructions</a> for more information.</li>' +
'<li>Try completely uninstalling every version of the plugin and reinstalling. ' +
'Your server information will be saved.</li>' +
Expand Down Expand Up @@ -1419,7 +1419,7 @@ define([
// setup hide input help icon
(function () {
var msg =
'Hiding input code cells results in rendering only the output of code cells on publication. <br> <a href="https://docs.rstudio.com/rsconnect-jupyter/usage/#hide-input" target="_blank">Hide Input Documentation</a>';
'Hiding input code cells results in rendering only the output of code cells on publication. <br> <a href="https://docs.posit.co/rsconnect-jupyter/usage/#hide-input" target="_blank">Hide Input Documentation</a>';

var helpIcon = $(
[
Expand Down Expand Up @@ -1494,7 +1494,7 @@ define([
xhr.match(/No module named .*rsconnect.*/) !== null
) {
msg = 'The rsconnect-python package is not installed in your current notebook kernel.<br />' +
'See the <a href="https://docs.rstudio.com/rsconnect-jupyter/#installation" target="_blank">' +
'See the <a href="https://docs.posit.co/rsconnect-jupyter/#installation" target="_blank">' +
'Installation Section of the rsconnect-jupyter documentation</a> for more information.';
} else if (typeof xhr === 'string') {
msg = 'An unexpected error occurred: ' + xhr;
Expand Down Expand Up @@ -2104,7 +2104,7 @@ define([
) {
$status.html(
'The rsconnect-python package is not installed in your current notebook kernel.<br />' +
'See the <a href="https://docs.rstudio.com/rsconnect-jupyter/#installation" target="_blank">' +
'See the <a href="https://docs.posit.co/rsconnect-jupyter/#installation" target="_blank">' +
'Installation Section of the rsconnect-jupyter documentation</a> for more information.'
);
} else if (typeof response === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ long_description_content_type = text/markdown
name = rsconnect_jupyter
url = http://github.com/rstudio/rsconnect-jupyter
project_urls =
Documentation = https://docs.rstudio.com/rsconnect-jupyter
Documentation = https://docs.posit.co/rsconnect-jupyter

[options]
install_requires =
Expand Down

0 comments on commit 03bcfbf

Please sign in to comment.