-
AuthorPosts
-
September 17, 2020 at 2:27 pm #1246537
I have added a JS Script to Enfold theme Google Service Integration. For logged out users its taking \n and \t instead of space and new line: Even Analytics code in added with \n and \t.
Site – https://narayananethralayaads.com/
Script –
var analytics_code = “<script type=’text\/javascript’ src=’\/\/widget.bajajfinserv.in\/public\/js\/jquery.min.js?v=1.7′ defer><\/script>\n<script>\nvar http = ‘http:’,wdsbjpg = ”,wdsbjms=”,wdsbjhp=”,wdsbjhost=window.location.hostname,wdsbjstmp = new Date().getTime(),wdsbjstmp=wdsbjstmp+Math.floor(Math.random() * 999999),wdsbjsstld = new Date().getTime(),wdsbjsstld=wdsbjsstld+Math.floor(Math.random() * 999999);\nif(window.location.protocol ==’https:’){ http = ‘https:’; }\nvar jqWidbetNew = jQuery.noConflict();\njqWidbetNew(function() {\nvar cookies = document.cookie.split(‘;’);\nfor (var i = 0; i < cookies.length; i++) {\nvar cookie = cookies[i];\nvar eqPos = cookie.indexOf(‘=’);\nvar name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;\nif(name==’kp’ || name==’ kp’){\ncookie = cookie.replace(‘ ‘, ”);\nwdsbjhp = cookie;\n}\n}\njqWidbetNew.ajax({\ntype: ‘GET’,\ncrossDomain:true,\ndataType:’json’,\nurl:http+’\/\/widget.bajajfinserv.in\/gettoken\/emi?’+wdsbjhp+’&vrn=’+wdsbjstmp+’&hst=’+wdsbjhost,\nsuccess: function(data) {\ndocument.cookie=’rid=’+data.rid;\nvar sessssId = document.cookie;\nif(sessssId.indexOf(‘kp’) != -1){}else{\ndocument.cookie=’kp=’+data.kp;\n}\nif(data.is_exipiry == ‘1’){\ndocument.cookie=’kp=’+data.kp;\n}\nvar cookies = document.cookie.split(‘;’);\nfor (var i = 0; i < cookies.length; i++) {\nvar cookie = cookies[i];\nvar eqPos = cookie.indexOf(‘=’);\nvar name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;\nif(name==’kp’ || name==’ kp’){\ncookie = cookie.replace(‘ ‘, ”);\nwdsbjpg = cookie;\n}\nif(name==’rid’ || name==’ rid’){\ncookie = cookie.replace(‘ ‘, ”);\nwdsbjms = cookie;\n}\n}\nwdsbjpg += ‘&’+wdsbjms;\nwdsbjpg += ‘&widgetid=10105’;\nwdsbjpg += ‘&vrn=’+wdsbjsstld;\nwdsbjpg += ‘&hst=’+wdsbjhost;\njqWidbetNew.ajax({\ntype: ‘GET’,\ncrossDomain:true,\nurl:http+’\/\/widget.bajajfinserv.in\/project\/emi?’+wdsbjpg,\nsuccess: function(data) {\nif(jqWidbetNew(‘#Externalwidget’).length > 0){\njqWidbetNew(‘#Externalwidget’).html(data);\n}else{\nsetTimeout(function(){ jqWidbetNew(data).appendTo(‘body’); }, 1700);\n}\n}\n});\n}\n});\n});\n<\/script>\n\n<!– Global site tag (gtag.js) – Google Analytics –>\n<script async src=\”https:\/\/www.googletagmanager.com\/gtag\/js?id=UA-27059090-1\”><\/script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag(‘js’, new Date());\n\n gtag(‘config’, ‘UA-27059090-1’);\n<\/script>\n<!– Global site tag (gtag.js) – Google Ads: 847230140 –>\n<script async src=\”https:\/\/www.googletagmanager.com\/gtag\/js?id=AW-847230140\”><\/script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag(‘js’, new Date());\n\n gtag(‘config’, ‘AW-847230140’);\n<\/script>”.replace(/\”/g, ‘”‘ );
var html = document.getElementsByTagName(‘html’)[0];September 17, 2020 at 3:11 pm #1246555Hey flavoursmedia,
Can you try to add the code via hooks?
Please follow the instructions here: https://kriesi.at/documentation/enfold/add-custom-js-or-php-script/#add-a-script-to-footer-sectionBest regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.