Skip to content
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
2 changes: 0 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# frozen_string_literal: false

class ApplicationController < ActionController::Base
include ApplicationHelper

before_action :redirect_if_old_domain
before_action :adobe_titles

protect_from_forgery only: [:update, :get, :put, :delete]

Expand Down
43 changes: 0 additions & 43 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,47 +30,4 @@ def info_site_home_page?
params["host"] == ENV['MLN_INFO_SITE_HOSTNAME'] && params["controller"] == "info_site" && params["action"] == "index"
end

def adobe_titles
originating_location = request.fullpath
site_section = ""
page_title = 'mylibrarynyc' + '|'
if originating_location.present?
if originating_location == "/"
site_section = 'Home'
page_title += 'home'
elsif originating_location == "/signin"
site_section = 'Account'
page_title += 'sign-in'
elsif originating_location == "/signup"
site_section = 'Account'
page_title += 'sign-up'
elsif originating_location == "/account_details"
site_section = 'Account'
page_title += 'account-details'
elsif ["/schools", "/participating-schools"].include?(originating_location)
page_title += "participating-schools"
site_section = 'Marketing'
elsif originating_location == "/faq"
page_title += "frequently-asked-questions"
site_section = 'Marketing'
elsif originating_location == "/contact"
page_title += "contact"
site_section = 'Marketing'
elsif params["controller"] == "teacher_sets" && params["action"] == "index"
site_section = 'Teacher Sets'
page_title += 'search-teacher-sets'
elsif (params["controller"] == "holds" && params["action"] == "ordered_holds_details") ||
params["controller"] == "holds" && params["action"] == "create"
site_section = 'Order'
page_title += 'order-details'
elsif params["controller"] == "holds" && params["action"] == "holds_cancel_details"
site_section = 'Order'
page_title += 'cancel-order'
elsif originating_location == "/teacher_set_data"
site_section = 'Teacher Sets'
page_title += 'search-teacher-sets'
end
end
[page_title, site_section]
end
end
23 changes: 0 additions & 23 deletions app/javascript/components/NewsLetter/NewsLetter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ export default function NewsLetter() {
};

const newLetterSignup = () => {
if (successFullySignedUp) {
if (env.RAILS_ENV !== "test" && env.RAILS_ENV !== "development") {
{
adobeAnalyticsForNewsLetter();
}
}
}
return (
<NewsletterSignup
id="news-letter-text-input"
Expand Down Expand Up @@ -104,22 +97,6 @@ export default function NewsLetter() {
);
};

const adobeAnalyticsForNewsLetter = () => {
// Push the event data to the Adobe Data Layer
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push({
event: "virtual_page_view",
page_name: "mylibrarynyc|news-letter-signup",
site_section: "News Letter",
});

// Dynamically create and insert the script tag for Adobe Launch
const script = document.createElement("script");
script.src = env.ADOBE_LAUNCH_URL; // assuming you are using a bundler that supports environment variables
script.async = true;
document.head.appendChild(script);
};

return (
<Box ref={newsLetterMsgRef} id="news-letter-success-msg">
{newLetterSignup()}
Expand Down
20 changes: 0 additions & 20 deletions app/javascript/components/TeacherSetBooks/TeacherSetBooks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ export default function TeacherSetBooks() {
setTeacherSets(res.data.teacher_sets);
setIsSchoolActive(res.data.is_school_active);
setBook(res.data.book);
if (env.RAILS_ENV !== "test" && env.RAILS_ENV !== "development") {
adobeAnalyticsForTeacherSetBooks(res.data.book)
}
if (res.data.book.title !== null) {
document.title = "Book Details | " + res.data.book.title + " | MyLibraryNYC";
} else {
Expand All @@ -112,23 +109,6 @@ export default function TeacherSetBooks() {
});
}, []);

const adobeAnalyticsForTeacherSetBooks = (book) => {
let title = book.title !== null ? book.title : ""
// Push the event data to the Adobe Data Layer
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push({
event: "virtual_page_view",
page_name: 'mylibrarynyc|book-details|' + title ,
site_section: 'Teacher Sets'
});

// Dynamically create and insert the script tag for Adobe Launch
const script = document.createElement('script');
script.src = env.ADOBE_LAUNCH_URL; // assuming you are using a bundler that supports environment variables
script.async = true;
document.head.appendChild(script);
};

const IsBookSubTitlePresent = () => {
return book["sub_title"] === null ? false : true;
};
Expand Down
40 changes: 0 additions & 40 deletions app/javascript/components/TeacherSetDetails/TeacherSetDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ export default function TeacherSetDetails(props) {
console.log(userStatus)
setIsSchoolActive(res.data.is_school_active)
setDisabledButton(!res.data.is_school_active)
if (env.RAILS_ENV !== "test" && env.RAILS_ENV !== "development") {
adobeAnalyticsForTeacherSet(res.data.teacher_set);
}
if (res.data.teacher_set.title !== null) {
document.title =
"Teacher Set Details | " +
Expand All @@ -135,23 +132,6 @@ export default function TeacherSetDetails(props) {
setQuantity(event.target.value);
};

const adobeAnalyticsForTeacherSet = (teacher_set) => {
// Push the event data to the Adobe Data Layer
let title = teacher_set.title !== null ? teacher_set.title : "";
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push({
event: "virtual_page_view",
page_name: "mylibrarynyc|teacher-set-details|" + title,
site_section: "Teacher Sets",
});

// Dynamically create and insert the script tag for Adobe Launch
const script = document.createElement("script");
script.src = env.ADOBE_LAUNCH_URL; // assuming you are using a bundler that supports environment variables
script.async = true;
document.head.appendChild(script);
};

const handleSubmit = (event) => {
event.preventDefault();
setDisabledButton(true);
Expand All @@ -169,11 +149,6 @@ export default function TeacherSetDetails(props) {
return false;
} else {
if (res.data.status === "created") {
if (env.RAILS_ENV !== "test" && env.RAILS_ENV !== "development") {
{
adobeAnalyticsForOrder();
}
}
props.handleTeacherSetOrderedData(res.data.hold, teacherSet);
navigate("/ordered_holds/" + res.data.hold["access_key"]);
} else {
Expand All @@ -187,21 +162,6 @@ export default function TeacherSetDetails(props) {
})
};

const adobeAnalyticsForOrder = () => {
// Push the event data to the Adobe Data Layer
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push({
event: "virtual_page_view",
page_name: "mylibrarynyc|order-details",
site_section: "Order",
});

// Dynamically create and insert the script tag for Adobe Launch
const script = document.createElement("script");
script.src = env.ADOBE_LAUNCH_URL; // assuming you are using a bundler that supports environment variables
script.async = true;
document.head.appendChild(script);
};

const teacherSetTitle = () => {
return <>{teacherSet["title"]}</>;
Expand Down
21 changes: 0 additions & 21 deletions app/javascript/components/TeacherSetOrderDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,6 @@ export default function TeacherSetOrderDetails(props) {
}
};

const adobeAnalyticsForCancelOrder = () => {
// Push the event data to the Adobe Data Layer
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push({
event: "virtual_page_view",
page_name: "mylibrarynyc|order-cancelled",
site_section: "Order",
});

// Dynamically create and insert the script tag for Adobe Launch
const script = document.createElement("script");
script.src = env.ADOBE_LAUNCH_URL; // assuming you are using a bundler that supports environment variables
script.async = true;
document.head.appendChild(script);
};

const teacherSetOrderDetails = () => {
let orderCancellled = "";
let orderUpdatedDate = "";
Expand All @@ -92,11 +76,6 @@ export default function TeacherSetOrderDetails(props) {
"dddd, mmmm d, yyyy"
);
showCancelledDate = "display_block";
if (env.RAILS_ENV !== "test" && env.RAILS_ENV !== "development") {
{
adobeAnalyticsForCancelOrder();
}
}
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,6 @@ export default function TeacherSetOrderDetails(props) {
}
};

const adobeAnalyticsForCancelOrder = () => {
// Push the event data to the Adobe Data Layer
window.adobeDataLayer = window.adobeDataLayer || [];
window.adobeDataLayer.push({
event: "virtual_page_view",
page_name: "mylibrarynyc|order-cancelled",
site_section: "Order",
});

// Dynamically create and insert the script tag for Adobe Launch
const script = document.createElement("script");
script.src = env.ADOBE_LAUNCH_URL; // assuming you are using a bundler that supports environment variables
script.async = true;
document.head.appendChild(script);
};

const teacherSetOrderDetails = () => {
let orderCancellled = "";
let orderUpdatedDate = "";
Expand All @@ -92,11 +76,6 @@ export default function TeacherSetOrderDetails(props) {
"dddd, mmmm d, yyyy"
);
showCancelledDate = "display_block";
if (env.RAILS_ENV !== "test" && env.RAILS_ENV !== "development") {
{
adobeAnalyticsForCancelOrder();
}
}
}

return (
Expand Down
20 changes: 0 additions & 20 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@
<%= csp_meta_tag %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_include_tag "application", "data-turbo-track": "reload", type: "module" %>
<% page_title, site_section = adobe_titles %>
<!-- Initial Data Layer Definition -->
<% if page_title.present? && site_section.present? %>
<script>
<!-- First define the global variable for the entire data layer array -->
window.adobeDataLayer = window.adobeDataLayer || [];
<!-- Then push in the variables required in the Initial Data Layer Definition -->
window.adobeDataLayer.push ({
event: "virtual_page_view",
page_name: '<%= page_title %>' ,
site_section: '<%= site_section %>',
});
</script>
<!-- Tag Manager Library Script -->
<% if ["qa", "production"].include?(ENV["RAILS_ENV"]) %>
<script src=<%= ENV["ADOBE_LAUNCH_URL"] %> async></script>
<% end %>
<% end %>

<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
Expand Down Expand Up @@ -55,6 +36,5 @@
const env = {
MLN_INFO_SITE_HOSTNAME: "<%= ENV["MLN_INFO_SITE_HOSTNAME"] %>",
RAILS_ENV: "<%= ENV["RAILS_ENV"] %>",
ADOBE_LAUNCH_URL: "<%= ENV["ADOBE_LAUNCH_URL"] %>",
};
</script>
Loading
Loading