I am using the BigCommerce cornerstone theme.
Where do I place the Lucky Orange Email Implementation Code?
I placed the code in the "Footer Scripts." But this didn't work.
The code from Lucky Orange is below.
<script type='text/javascript'>
window.__lo_site_id = 120178;
(function() {
var wa = document.createElement('script'); wa.type = 'text/javascript';
wa.async = true;
wa.src = 'https://d10lpsik1i8c69.cloudfront.net/w.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wa, s);
})();
</script>
Related
Here is the embed code that was generated by the countdown timer widget:
<div class="tc_div_41086" style="width:650px;height:162.50px;border:1px solid #C0C0C0">
<a title="Countdown to North Texas Giving Day" href="http://www.tickcounter.com/widget/countdown/1474527600000/america-chicago/dhms/FFFFFF76BD1D000000FF0000/650/C0C0C01/Countdown_to_North_Texas_Giving_Day">Countdown to North Texas Giving Day</a>
<a title="Countdown" href="http://www.tickcounter.com/">Countdown</a>
</div>
<script type="text/javascript">
(function() {
var s = document.createElement('script');
s.src = "http://www.tickcounter.com/loader.js";
s.async = 'async';
s.onload = function() {
tc_widget_loader('tc_div_41086', 'Countdown', 650, ["1474520400000", "america-chicago", "dhms", "FFFFFF76BD1D000000FF0000", "650", "C0C0C01", "Countdown to North Texas Giving Day"]);
};
s.onreadystatechange = s.onload;
var head = document.getElementsByTagName('head')[0];
head.appendChild(s);
}());
</script>
add this css
.tc_div_41086{
pointer-events: none;
}
I need to place an entire javascript function in a div and show it for testing purposes, how can I accomplish this? I am doing this from code behind in asp.net
EDIT
<!-- Facebook Conversion Code for Website Purchase -->
<script type='text/javascript'>
(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
})();
window._fbq = window._fbq || [];
</script>
Edit: You need to do some trickery: How to show <div> tag literally in <code>/<pre> tag? Which says that you need to escape your < and > characters in your tag to < and > for them to show in the <pre>. The example below has been modified to show this.
You should try using the html <pre> tag, it's commonly supported and does exactly what you're asking for:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre
<pre>
<script type="text/javascript">
console.log('hi');
</script>
</pre>
should show something like
<script type="text/javascript">
console.log('hi');
</script>
I want to give users a snippet to put on their own sites which loads a generic javascript file with a unique ID for that user. This is so the content which loads up is dependant on which user id is associated with it.
My best guess so far is something like this:
<script type="text/javascript">
var UID = '';
(function() {
var url = www.test.com/embed.js';
})();
</script>
<noscript>Please enable JavaScript to view this content</noscript>
content powered by <span class="logo">Test</span>
I havent had a lot of luck with this code. Can anyone explain how I should be approaching this please?
Here is the way that google does it. Let me know if you need help applying it:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var 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';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Ref. https://developers.google.com/analytics/devguides/collection/gajs/
You need to append <script> tag to the DOM.
You should put your entire script inside a single scope (function)
(function(window, uid) {
var document = window.document;
// create your <script> element
var e = document.createElement("script");
e.src = "//my.website.com/my-script.js?user-id=" + window.encodeURIComponent(uid);
// insert it before the very first <script> element already in DOM
var s = document.body.getElementsByTagName("script")[0];
s.parentNode.insertBefore(e, s);
})(window, "some-user-id");
I have a Google+ +1 button and seems to work fine since I can see the +1 in a Google search. The problem is that the count box doesn't keep the number of +1.
Am I doing something wrong? You can see on http://itransformer.es
I've added the next html tag:
<div class="g-plusone" style="display: clear" data-width="200" data-href="http://itransformer.es"></div>
and the next Javascript snippet code:
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
Well, I've found the issue. I was using http://itransformer.es URL, while I had to use http://www.itransformer.es. Now the +1's are shown.
This question looks a little dumb... but I am wondering if is it possible to insert in-line javascript code into another javascript code. Lets put this clear:
I'm trying to put a google plus button, appending it through jquery as follows:
jQuery('.gplus').append('<g:plusone annotation="inline"></g:plusone>');
This button needs external js in order to work properly. What i'm trying to do is insert the external js doing this:
var gplusjs = '
<script type="text/javascript">
(function() {var po = document.createElement("script");
po.type = "text/javascript"; po.async = true;
po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(po, s);
})();
</script>';
jQuery('#js').append(gplusjs);
The result of this is the code printed as HTML, but not interpreted as a script.
This is possible? I am a dumbass? Thanks!
That's because jQuery append and scripts don't work. Do it the old fashioned way
var gplusjs = '(function() {var po = document.createElement("script");po.type = "text/javascript"; po.async = true;po.src = "https://apis.google.com/js/plusone.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(po, s);})();';
var script = document.createElement("script");
script.textContent = gplusjs;
document.head.appendChild(script);
Also note that multi line string literals don't exist in JS.
You should just execute that code normally:
var po = document.createElement("script");
po.type = "text/javascript"; po.async = true;
po.src = "https://apis.google.com/js/plusone.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(po, s);
Or, even easier:
$.getScript("https://apis.google.com/js/plusone.js");