• Some FB users require their data for FB to be cryptographically secure
  • Facebook allow this using SHA256 ( Secure Hash Algorithm )
  • Here we will demonstrate how to do this

First we need to add our scripts to the global or DT level scripts section. ( In the DT settings )

That means the FB pixel and the js-sha256 library.

Both above the <head> Like so:

The library tag to copy/paste looks like this:

<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.9.0/sha256.js" integrity="sha512-8WAv/Z7UaDv0U1DCJ3W1oul76HOvq2/9mc+IbOZGsTj9iwZnnCXL/0FS6GQKNR++krdfVn9kuAAQ6v2DqZ9uEQ==" crossorigin="anonymous"></script>

In a node you want to track setup a node level script like so. ( Inside the node on the bottom right )

Then copy paste this tracking code into the script.

<script>
 //Create a UNIX timestamp
 ts = Math.round((new Date()).getTime() / 1000);
 //Capture the answer
 answer = '{_c_answer}';
 //Create the hash
 hash = sha256(answer);
 //Fire the FB pixel  
 fbq('track', 'ViewContent', {
   event_time: ts,
   content_name: '{_c_dt}',
   content_category: '{_c_node}',
   content_ids: ['{_c_question}'],
   content_type: hash
 });
</script>

Done!

Leave a Reply

Your email address will not be published.