Installing Tracking Tag in Shopify

If you use Shopify to host your online store, you'll need to correctly install the Perfect Audience site tracking tag and conversion code into your Shopify Settings.

1. Installing the Tag

In your "Manage" menu 
click User Tracking.

This will pull up a page with a javascript tag that looks like this:


Switch to your Shopify dashboard.
Click Online store, then Themes.

Click ... then Edit HTML/CSS

Under Layouts, select theme.liquid.

Scroll to the bottom of the code.
Paste the site tracking tag just above the </body> tag.
Optional: If you plan to use dynamic ads with your Shopify store, you'll need to modify the line of code beginning with "_pa.product.Id" in the site tracking tag. Remove the // in this line and modify it to look like this:

_pa.productId="{{product.id}}";

Note: If you are using the Shopify App, Google Shopping, AND have an international store, you'll modify the line of code to look like this: 

_pa.productId="shopify_<input your specific country information>_{{product.id}}_{{product.variants.first.id}}";

Example of completed code: _pa.productId="shopify_nl-BE_{{product.id}}_{{product.variants.first.id}}";

Scroll to the top of the page and press Save. 

2. Setup Your Conversion Goal

Next, you'll need to add some code to track your conversions. In your Shopify settings, click the Checkout tab:


Then, in the Additional Content & Scripts box, paste in this code:

<script type="text/javascript">
window._pq = window._pq || [];
_pq.push(['track', 'PurchasedItem', {orderId: "{{ order_number }}", revenue: ({{ subtotal_price }}/100)}])</script>

IMPORTANT: In addition to this code, you will also need to paste your regular site tracking tag found under Manage-> User Tracking in this box. This is the same tag that you installed in Step One of this guide.

Then Save. Back in Perfect Audience, click Manage-> Create Conversion. Use the following settings:


Then save the conversion goal. 

Wait for the e-mail! Now that your tag is on your Shopify store, you will receive an e-mail when our system starts seeing data. You can also check back to the Site Tracking Tag page to see if data is being recived. This usually takes an hour or two. If you don't get an e-mail or see data on your tag page or Audiences page, double check that you've placed the tag in your web site code and pushed that code live. It can be easy to forget a simple step in there along the way.

If you have any problems, email support@perfectaudience.com

Feedback and Knowledge Base