24/7 Support: 800.608.6482

Navigation


Facebook Conversion Tracking For Miva

Overview

The following guide will walk you through how to setup Facebook Conversion Tracking using Facebook's Conversions API. This API allows for a direct server to server tracking of a conversion event (ie a Purchase). Sending the conversion via a Server call bypasses any potential issues where the traditional JavaScript conversion tracking may be blocked or fail to run in the browser.

https://developers.facebook.com/docs/marketing-api/conversions-api/

Installation & Setup

There are two parts to Facebook conversion tracking:

  1. 1. Global JavaScript Tracking Pixel – This is a JS snippet which gets output across every page of your site. More details: https://developers.facebook.com/docs/facebook-pixel/implementation/
  2. 2. Miva Template Code (Server Side) Conversion Tracking – This is a block of JSON data which gets sent to Facebook by the server only on the Invoice page when an order is placed. This sends important data to Facebook such as the items in the order and the Facebook campaign id which the customer clicked on which brought them to the site.

Step 1

Import XML File

Miva provides an XML file which does all the setup and heavy lifting to getting this installed on your Miva store. Download the following file and import it to your store under:

Data Management -> Import Data and Settings in XML Provisioning Format

View & Download XML File

This file does the following tasks upon import:

  1. 1. Creates a global tracking script under User Interface -> CSS/Javascript Resources -> JavaScript Resources named "facebook_global_tracking"
  2. 2. Creates a separate "facebook_conversion_tracking" snippet which only gets output on the INVC page to send the conversion data to Facebook
  3. 3. Assigns both Snippets to the head_tag to be output.

Important Note: Before you import the XML file it’s recommended you first create a new Template Branch so you can make these changes in a staging environment and test them prior to pushing to live. The JS resources will get added to whatever the active template branch you’re working on in the admin.

Step 2

Generate Your API Keys

The XML creates code with placeholder data for the Account/API keys. You need to create your own update the placeholder data. There are two pieces of data you need from Facebook:

  1. 1. Facebook Pixel ID
  2. 2. Access Token

Create and install you Facebook pixel: https://www.facebook.com/business/help/952192354843755?id=1205376682832142

You need Facebook Business Manager Account: https://www.facebook.com/business/help/1710077379203657?id=180505742745347

Then login Facebook Events Manager: Events Manager

From here under the Settings Tab for your Tracking Pixel you’ll find the Access Token: https://developers.facebook.com/docs/marketing-api/conversions-api/get-started#via-events-manager

Facebook Pixel

Step 3

Replace Pixel and Token with Your Own

There are three places to update.

  1. 1. Under User Interface -> CSS/JavaScript Resources -> JavaScript Resources -> facebook_global_tracking resource. Select the resource and under the more menu (…) click "Edit Source"
    Replace the placeholder XXXXXXXXXXX with your Facebook Tracking Pixel ID Facebook Tracking Code
  2. 2. Under User Interface -> CSS/JavaScript Resources -> JavaScript Resources -> facebook_conversion_tracking resource. Select the resource and under the more menu (…) click "Edit Source"
    Change the “pixelID” and “accesstoken” variables: Facebook Conversion Code

Hit update to save.

Step 4

Place a Test Order

The final step is to place a test order and confirm that tracking pixel and conversion tracking code is working as expected. Recent Activity and conversions will show in Events Manager.

Copyright © 1997 – 2024 Miva®, Miva Merchant®, MivaPay®, MivaCon®, Camp Miva®, Miva Connect®, Miva, Inc. All Rights Reserved.