Skip to content

Commit

Permalink
KWRAV-566 #Issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Banura Randika committed Apr 2, 2020
1 parent 12b5655 commit bc054d9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 50 deletions.
50 changes: 0 additions & 50 deletions app/assets/javascripts/acts_as_seoable.js.erb

This file was deleted.

53 changes: 53 additions & 0 deletions app/views/acts_as_seoable/_acts_as_seoable.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<script>
this.GoogleAnalytics = (function () {
function GoogleAnalytics() {
}

GoogleAnalytics.load = function () {
var firstScript, ga;
window._gaq = [];
window._gaq.push(["_setAccount", GoogleAnalytics.analyticsId()]);
ga = document.createElement("script");
ga.type = "text/javascript";
ga.async = true;
ga.src = ("https:" === document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
firstScript = document.getElementsByTagName("script")[0];
firstScript.parentNode.insertBefore(ga, firstScript);
if (typeof Turbolinks !== 'undefined' && Turbolinks.supported) {
return document.addEventListener("turbolinks:load", (function () {
return GoogleAnalytics.trackPageview();
}), true);
} else {
return GoogleAnalytics.trackPageview();
}
};

GoogleAnalytics.trackPageview = function (url) {
if (!GoogleAnalytics.isLocalRequest()) {
if (url) {
window._gaq.push(["_trackPageview", url]);
} else {
window._gaq.push(["_trackPageview"]);
}
return window._gaq.push(["_trackPageLoadTime"]);
}
};

GoogleAnalytics.isLocalRequest = function () {
return GoogleAnalytics.documentDomainIncludes("local");
};

GoogleAnalytics.documentDomainIncludes = function (str) {
return document.domain.indexOf(str) !== -1;
};

GoogleAnalytics.analyticsId = function () {
return "<%= GoogleAnalyticSeo.first.content %>";
};

return GoogleAnalytics;

})();

GoogleAnalytics.load();
</script>

0 comments on commit bc054d9

Please sign in to comment.