Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A Technique for Tracking Prints Using CSS: http://wp.me/pcVrg-XF
<cfscript>
param name='args.qrURL' default=prc.page.getCanonical();
</cfscript>
<cfoutput>
<div class="u--printonly detail--trackprint">
<p>#_('qrcode_explanation', 'Scan the following QR code to learn more.')#</p>
<img class="u--box" src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&amp;data=#HTMLEditFormat( args.qrURL )#" alt="">
<p>(#HTMLEditFormat( args.qrURL )#)</p>
<img src="?trackprint" alt="">
</div>
</cfoutput>
@media print {
.detail--trackprint {
background: url("?trackprint");
}
}
<cfscript>
param name='args.qrURL' default=prc.page.getCanonical();
</cfscript>
<cfoutput>
<div class="u--printonly detail--trackprint">
<style>@media print { .detail--trackprint { background: url("?trackprint"); } }</style>
<p>#_('qrcode_explanation', 'Scan the following QR code to learn more.')#</p>
<img class="u--box" src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&amp;data=#HTMLEditFormat( args.qrURL )#" alt="">
<p>(#HTMLEditFormat( args.qrURL )#)</p>
</div>
</cfoutput>
<cfscript>
param name='args.qrURL' default=prc.page.getCanonical();
</cfscript>
<cfoutput>
<div class="u--printonly detail--trackprint">
<style>@media print { .detail--trackprint { background: url("?trackprint=#URLEncodedFormat( now() )#"); } }</style>
<p>#_('qrcode_explanation', 'Scan the following QR code to learn more.')#</p>
<img class="u--box" src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&amp;data=#HTMLEditFormat( args.qrURL )#" alt="">
<p>(#HTMLEditFormat( args.qrURL )#)</p>
</div>
</cfoutput>
component {
property name='id' type='numeric' default=0;
property name='model' inject='model:inventoryModel';
public any function trackPrint() {
getModel().trackPrint( getId() );
var trackingPixel = imageRead(expandPath('/images/transparent.gif'));
return trackingPixel;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment