1. Knowledge base
  2. Serverside Hybrid Universal Integration

How to set up a full Server-side Hybrid Universal Integration

Last updated: 2024-03-03

There are 3 steps to complete the integration.

  1. Sending orders to ProfitMetrics serverside
  2. Install the Server-side Hybrid Universal Integration tracking script on your website in one of two ways.
    1. Install the Serverside Hybrid Universal Integration script
    2. Install the Serverside Hybrid Universal Integration script in Google Tag Manager
  3. Producing product feed

Important information when Migrating from Client-side Universal Integration to Server-side Hybrid Universal Integration

If you are migrating from a Universal Integration, the previous scripts called pmOriginTrack and pmLogOrder need to be removed.


Part 1: Sending orders to ProfitMetrics serverside

Send orders to the following endpoint as a GET request.

https://my.profitmetrics.io/l.php
Add the following parameters
Parameter Description Nortes
v

Version

Required - Must be set to ”3uh”

pid

Website Public ID

Required

o

Orderspec, JSON object containing order data

Required - Must be URL-encoded


IMPORTANT: It is important to implement a delay of 10 minutes from the order is received, to the order is sent. This is important to ensure the tracking data is received before the order.

Build the Orderspec JSON object. 

While some fields are REQUIRED and others are RECOMMENDED, we strongly recommend filling out as many as possible. Any missing fields will directly limit functionalities within ProfitMetrics.

Any fields that are not filled, should be omitted from the orderspec object, or set to null. They can not be empty or undefined.

Field name Type Description Notes

id

String

Unique order id

Required
ts Number

Unix timestamp, second resolution

Required
orderEmail String

Customer email

Required *1
orderEmailMD5  String

Customer email, sha256 hashed. It is vital that the email must be trimmed and lowercased BEFORE hashing.

Required *1
orderEmailSHA256 String

Customer email, sha256 hashed. It must be lowercased and trimmed, and the part before ’@’ must be stripped of any dots(.) if the domain part is googlemail.com or gmail.com. Example: ” John.Mcafee@gmail.com” would be preprocessed to ”johnmcafee@gmail.com”, and then hashed

Required *1
orderEmailSHA256GA String

Customer email, sha256 hashed. It is vital that the email must be trimmed and lowercased BEFORE hashing.

Required *3
customerPhone String

Customer phone number. There must be no letters or whitespaces, and it must include the countrycode number, area codes, and actual phone number. For example: ”16505551212” for a north american phone number, or ”4542504250” for a danish phone number

Recommended
customerPhoneMD5 String

md5 hashed version of customerPhone

Recommended *2
customerPhoneSHA256 String

sha256 hashed version of customerPhone

Recommended *2
shippingMethod String

Shipping method name

Required
shippingCountry String

Should be in ISO 3166-1 alpha-2 format

Recommended
shippingZipcode String

Destination zipcode

Recommended
shippingWeight Number

Weight in grams

Recommended
paymentMethod String

Payment method name

Required
currency String

Format is 3 letter ISO 4217. Examples: “DKK”, “EUR”

Recommended
voucherCode String

gift/voucher code used

Optional
priceShippingExVat Number

The charged price for shipping, excl VAT

Recommended
priceTotalExVat Number

Total charged/paid price, excluding VAT

Required
priceTotalInclVat Number

otal charged/paid price, including VAT

Required
products Array

Array of objects

Required

*1: The orderEmail is required, either in plaintext or hash. If plaintext is supplied, hashes do not need to be submitted. If plaintext is left out, then both md5 and sha256 hash of the email must be submitted

*2 Its optional to provide the customer phone number, but if it is provided, either simply the customerPhone field should be provided, or both customerPhoneMD5 and customerPhoneSHA256

*3 This should not be supplied if plaintext orderEmail is supplied. In case it is not, we strongly recommend supplying this, or some features will be much less precise(Google Ads enhanced conversions) *4 While it is possible to operate without this data, it severely limits functionality, so we very strongly recommend to send these fields unless it is absolutely not possible

*4 While it is possible to operate without this data, it severely limits functionality, so we very strongly recommend to send these fields unless it is absolutely not possible.


Products array objects contains the following fields:

Field name

Type

Description

Remarks

sku

String

The product sku must be that of the fully qualified variant purchased, and identical to the
sku/product id in the feed of products loaded into profitmetrics. It must not be an empty string

Required

qty

Number

Quantity

Required

priceExVat

Number

Unit price excluding VAT

Required


Example json orderspec:

{
"id": "12430345",
"ts": 1616595095,
"orderEmail": "test@profitmetrics.io",
"customerPhone": "4542504250",
"shippingMethod": "UPS Nextday",
"shippingCountry": "Denmark",
  "shippingZipcode": "7400",
  "shippingWeight": 2500,
  "paymentMethod": "Stripe",
  "currency": "DKK",
  "voucherCode": "FREESHIPPING",
  "priceShippingExVat": 0,
  "priceTotalExVat": 100,
  "priceTotalInclVat": 125,
  "products": [
{
       "sku": "123431-12",
        "qty": 1,
"priceExVat": 50
},
{
      "sku": "123431-13",
"qty": 1,
"priceExVat": 50
}
]
}

Final GET request should look like this.

https://my.profitmetrics.io/l.php?v=3uh&pid=XXXXXXXXXXXXXXXX&o={"id":"XXXX","ts":1679476010,"orderEmail":"example@example.com","customerPhone":"00000000","shippingMethod":"SHIPPING","shippingCountry":"DK","shippingZipcode":"0000","shippingWeight":0000,"paymentMethod":"PAYMENTMETHOD","currency":"EUR","priceShippingExVat":0,"priceTotalExVat":100.00,"priceTotalInclVat":125.00,"products":[{"sku":"PRODUCT-ID","qty":1,"priceExVat":100.00},{"sku":"PRODUCT-ID","qty":1,"priceExVat":0}]}


Congratulations on completing Part 1!

Part 2 - Install the Serverside Hybrid integration one of two ways:

  1. Install the Serverside Hybrid Universal Integration script or
  2. Install the Serverside Hybrid Universal Integration script in Google Tag Manager