Resource Center

Pixel Signature Generation Code Examples

Integration Example

Private Key: 22a8fb83fb0d863fcf4c37033bd5ea24ee55aec9
Order Id: 54563131

Parameter

<...>&SIGNATURE=f21b23c92f4e4a4c5f92108b2de179d611dd5fa4801163bfdbbd8f7624bd8d63<...>

Parameter Integrated in Pixel

<iframe src="https://t.pepperjamnetwork.com/track?INT=DYNAMIC &PROGRAM_ID=000&ORDER_ID=54563131&SIGNATURE=f21b23c92f4e4a4c5f92108b2de179d611dd5fa4801163bfdbbd8f7624bd8d63<...>" width="1" height="1" frameBorder="0"></iframe>

HMAC Hashing

Algorithm  SHA256

 

Please see the code examples below for an example on how to implement HMAC hashing.

 

Javascript Code Example

const crypto = require("crypto"); 
const secret = "advertiser-secret";
const orderId = "order-id123";
const algorithm = "sha256";
const hash = crypto.createHmac(algorithm,secret); hash.update(orderId);
const signature = hash.digest('hex');

 

PHP Code Example

<?php 

// PHP Example
// Documenation
// https://www.php.net/manual/en/function.hash-hmac.php

$secret = 'advertiser-secret';
$orderId = 'order-id123';
$algorithm = 'sha256';
$signature = hash_hmac($algorithm, $orderId, $secret);

 

Ruby Code Example

# !/usr/bin/env ruby 

# Documenation
# https://ruby-doc.org/stdlib-2.4.0/libdoc/openssl/rdoc/OpenSSL/HMAC.html 

secret = "advertiser-secret"
order_id = "order-id123"
algorithm = "SHA256"
signature = OpenSSL::HMAC.hexdigest(algorithm, secret, order_id)

Python Code Example

# Python HMAC Example 

# Documentation
# https://docs.python.org/3/library/hmac.html
# https://docs.python.org/3/library/hashlib.html 

import hmac
import hashlib
secret = "advertiser-secret"
order_id = "order-id123"
algorithm = hashlib.sha256

# .encode converts the strings to bytes
signature = hmac.new(secret.encode(), order_id.encode(), algorithm).hexdigest()