PebblePost JavaScript Tag

Our JavaScript tag captures events generated by traffic on your website. These events are processed by PebblePost's proprietary optimization algorithms to decide which of your anonymous visitors will receive Programmatic Direct Mail™. In addition to help determine who will receive mail, our invisible and asynchronous JavaScript tag can also detect website purchases or other conversion activities. 

Your PebblePost Account Team will send you a custom ready-to-install JavaScript tag to install.

In this article

  1. Install using Google Tag Manager
  2. Install on a Shopify site
  3. Manual Installation
  4. Sample Tag (For Reference Only)
  5. Tag Variable Definitions

Installing the tag using Google Tag Manager

It's easy to use Google Tag Manager (GTM) to install the PebblePost JavaScript Tag. Just follow these steps: 

  1. Login to your GTM account and navigate to the container for the website where you'll install the PebblePost JavaScript Tag. 
  2. Create a new "Tag Configuration" with tag type "Custom HTML", optionally naming the new tag "PebblePost"
  3. Copy the custom ready-to-install PebblePost Javascript Tag given to you by your PebblePost team, and paste it into the "HTML" text area. 
  4. To customize variables with your dynamic data, replace the default values with your preexisting variables set up in GTM, ensuring that all mandatory and conversion tracking variables are accounted for. Note that all GTM variables should be wrapped in curly brackets {{ }}.
  5. Click "Save", and when prompted, click "Add Trigger", and check "All Pages" and then click "Add"
  6. Click "Save" one more time, name the new tag "PebblePost", and then follow these instructions to publish the PebblePost JavaScript Tag to your website. 


Install on a Shopify site

  1. Using Shopify's theme editor, open the file "theme.liquid" file
  2. Just above the </body> tag, paste the PebblePost JavaScript Tag "page" code given to you by PebblePost. The code contains your custom PebblePost Brand ID as well as the standard Shopify variables required for correct tag operation. Once it's pasted in, click the save button.
  3. Navigate to Settings > Checkout > Order Processing, and find the input area called "Additional Scripts"
  4. In the "Additional Scripts" input area, add the PebblePost JavaScript Tag Shopify Checkout code given to you by PebblePost, and then click the save button.

Manual Installation

Paste the javascript code given to you by PebblePost right before the  </body> tag on every page of your site. The code will contain your custom PebblePost Brand ID, but you will need to add particular variables listed below, including the Conversion Tracking variables on each checkout page.


Standard PebblePost JavaScript Tag (For Reference Only)

<script>
	window._pp = window._pp || [];
	//Mandatory variables
	_pp.brid = "naign493811njnk";
	_pp.brcid = "YOUR_CUSTOMER_ID_123"; 
	//Conversion Tracking Variables
	_pp.orderId = "ORDER12093";
	_pp.orderValue = "154.32";
	//Optional Variables
	_pp.email = "jon@doe.com";
 	_pp.sessionId = "abcde-1234-fghijk-5678";
	(function() {
		var ppjs = document.createElement('script');
		ppjs.type = 'text/javascript';
		ppjs.async = true;
		ppjs.src = ('https:' == document.location.protocol ? 'https:' : 'http:') +
		'//cdn.pbbl.co/SAMPLE/' + _pp.brid + '.js';
		var s = document.getElementsByTagName('script')[0];
		s.parentNode.insertBefore(ppjs, s);
	})();
</script>

Variable Definitions

Mandatory Variables

_pp.brid: Your PebblePost Brand ID. Provided by your account team.
_pp.brcid: Your unique internal customer ID.

Conversion Tracking Variables

_pp.orderId: The unique ID of your customer’s order.
_pp.orderValue: The total dollar amount of your customer’s order.

Optional Variables

_pp.email: Your customer’s email address.
_pp.sessionId: Your first party session ID for the user.