People are copying my content, and I think it’s great. I have even done some extra work to make it easier to copy codes/scripts I have published on this blog based on feedback from some visitors. The Remove formatting from Code that you find below is the result of that.
But I have also blog posts that don’t include any scripts. My question was therefore, did visitors find something interesting in those blog posts, and if yes, so interesting that they would copy some of the content?
Since I didn’t find any solution that suited my needs, I did put together my own cut/copy/paste tracking script using jQuery and a script from Motyar that detects selected/highlighted text.
Google Analytics Report for Copied Text
The report in Google Analytics will show you:
- Category: Clipboard
- Action: Copy, cut or paste.
- Label: The text copied/cutted/pasted.
- Value: How many characters were copied/cutted/pasted.
If you select Pages from the Event report, or Pages as a secondary dimension, you can drill down to the page the text was copied/cutted/pasted from/on. Or even better, create a Custom Report.
Script for Tracking Text Copied using jQuery
Below is the script for tracking text copied/cutted or pasted using jQuery. If you want to track more (or less) text, change the code in red.
I would also add a “warning” regarding this script. Don’t use it on pages that can contain PII (Personally Identifiable Information), just in case some people copy their own PII info from the page. This type of data is not allowed in Google Analytics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<script type="text/javascript"> // This script for tracking cut/copy/paste in Google Analytics is provided as it is, and was put together by Eivind Savio January 2013. Happy tracking! // Script from Motyar function getSelected() { if(window.getSelection) {return window.getSelection();} else if(document.getSelection) {return document.getSelection();} else { var selection = document.selection && document.selection.createRange(); if(selection.text) { return selection.text; } return false; } return false; } // End script from Motyar $(document).ready(function() { $('body').on('copy cut paste', function(ccp) { // Track cut, copy or paste with jQuery. var selection = getSelected(); var maxLength = 150; // Up to 150 Characters from your text will be tracked. Change this number if you want to track more or less text. if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) { var textLength = selection.length; // How many characters was copied/cutted/pasted. if (selection.length > maxLength) { selection = selection.substr(0, maxLength) + "..."} // If the text is longer than maxLength, add ... to the end of the text else { selection = selection; // If the text is shorter than maxLength, just track the text as it is. } _gaq.push(['_trackEvent', 'Clipboard', ccp.type, selection,textLength]); // Track copied/cutted/pasted data in Google Analytics as Events } }); }); </script> |
Some final words
Except from “curiosity” for what visitors are copying, do you see any other valuable areas for this kind of tracking? Protecting your work? SEO? Other content you should write about? Intention of sharing (headline copied)?
If you think the code could be improved, feel free to comment (I’m not a programmer).
jQuery 1.7 or later is needed for this script to work.
is this still works?
Yes, it still works. The GA code is old though, it’s for “Classic GA”. If you aren’t using that (hopefully you aren’t), rewrite the code to suit your needs (GA Universal or Google Tag Manager).
Is this tracking configured in Google Tag Manager ?, I need to be instructed more details about this tracking please.
There is a lot of use in being able to track this.
The Label will tell you precisely which segments of your article have engaged the reader, or which data is of value to them.
If it’s a logged in user, you can also profile your subscriber better and fine tune direct communications, and it is definitely useful for creating fine tuned audiences for display ads or retargeting in search and display, as well as for content recommendations based precisely on what an audience found valuable in the article.
An interesting variation would be to use the Category field article as Clipboard, the Action field to collate category names and tag names as comma separated values and the Label field for the copied text. From a business angle, I am not really interested if the cut or paste it.
The Action field would then be very useful, as we could create Google Segments and Audiences based on tag combinations (i.e. import audiences into Google Ads: Everyone who copied text from articles belonging to Personal Finance category, or Work Permit category.
Or, everyone who copied text with the Running Shoe Model X in the copied text.