Skip to content

change: upgrade Adobe Analytics cookie to 3.0 #2524

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

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/_static/aws-ux-shortbread/index.js

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions doc/_static/aws-ux-shortbread/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
(function (w) {
w.URLSearchParams = w.URLSearchParams || function (searchString) {
var self = this;
self.searchString = searchString;
self.get = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(self.searchString);
if (results === null) {
return null;
}
else {
return decodeURI(results[1]) || 0;
}
};
}
})(window);

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const lang = urlParams.get('lang')
window.onload = function () {
var domainName = window.location.hostname;

// remove an instance of shortbread if already exists
var existingShortbreadEl = document.getElementById("awsccc-sb-ux-c");
existingShortbreadEl && existingShortbreadEl.remove();

var shortbread = AWSCShortbread({
domain: domainName,
language: lang,
//queryGeolocation: function (geolocatedIn) { geolocatedIn("EU") },
});

shortbread.checkForCookieConsent();
}
7 changes: 6 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@

htmlhelp_basename = "%sdoc" % project

html_js_files = ["https://a0.awsstatic.com/s_code/js/1.0/awshome_s_code.js", "js/analytics.js"]
# For Adobe Analytics
html_js_files = [
"https://a0.awsstatic.com/s_code/js/3.0/awshome_s_code.js",
"aws-ux-shortbread/index.js",
"aws-ux-shortbread/init.js",
]

html_context = {"css_files": ["_static/theme_overrides.css"]}

Expand Down