In the past, I've had the displeasure of seeing my sites completely ripped off (front end), with some individuals even going so far as to copy every piece of content, including the GA tracking code :)
I'm considering inserting a hidden notice within the JS code so that if someone copies it, they (and their visitors) will be made aware. While I understand that front end code cannot be fully protected, if this deters even just a few people from using it (especially those who are not tech-savvy), then it's a win.
So far, I have taken the following steps (as recommended by Amy):
- minified & obfuscated the code
- added a copyright notice at the top
Here is a small snippet of what I plan to merge into the existing code:
if (window.location.hostname && window.location.hostname !== 'myDomain') {
document.body.style.opacity = '0.2';
document.body.style.pointerEvents = 'none';
c = [84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 114, 105, 112, 112, 101, 100, 32, 115, 105, 116, 101, 33];
alert(String.fromCharCode.apply(null, c));
}
<p>Lorem ipsum dolor sit amet, his aperiam percipit assueverit ea, sit ei eius adhuc tacimates. Cum ad numquam rationibus, mel eu scripta aliquando. Eum ex habemus constituto mediocritatem. Ea dicam aliquip salutatus usu, vidit admodum sadipscing at mei. Alterum blandit efficiendi duo in, dicat quodsi vidisse in quo, malis latine lucilius ad est. Qui enim explicari at, est cu iusto impetus, ferri iudico similique at eos.</p>
Are there any more unique strategies besides what I already have in place? :)