Skip to main content
Skip table of contents

Custom Code

Corvidae Script

The Corvidae subdomain must be set up before this script is published, please replace the trackerId string with a string matching your Corvidae subdomain.

This script should be added to the top of the <head> tag on every page of your website, and should be implemented to complete before either of the Pageview or Conversion tax execute.

HTML

Your Customer Success Manager will send you a plain-text version of this custom script during your onboarding.

CODE
<script type="text/javascript">
(function(w, d, s, f, c) {
    if (!w[c]) {
        w.CorvidaeNamespace = w.CorvidaeNamespace || [];
        w.CorvidaeNamespace.push(c);
        w[c] = function() {
            (w[c].q = w[c].q || []).push(arguments);
        };
        w[c].q = w[c].q || [];
        var n = d.createElement(s);
        var g = d.getElementsByTagName(s)[0];
        n.async = 1;
        n.src = f;
        g.parentNode.insertBefore(n, g);
    }
})(
    window,
    document,
    'script',
    '//cdn.corvidae.ai/pixel.min.js',
    'cvqueue'
);

// Pixel setup
var trackerId = 'corvidae.[your tracked domain]';
var appId = '[your tracked domain]';
var cookieDomain = '[your tracked domain]';
var property = [your tracked domain]';

qcpixel('newTracker', 'cf', trackerId, {
    appId: appId,
    forceSecureTracker: true,
    cookieDomain: cookieDomain,
    respectDoNotTrack: true,
    platform: 'web',
});
</script>

Pageview Script

This pixel tracks all clickstream traffic and referrer information and should be implemented on every customer-facing page on your site. This script should be added to the <head> tag on every page of your website, to fire as early as possible.

This script should execute only after the Corvidae Script has resolved.

HTML

CODE
<script type="text/javascript">
	cvqueue("trackPageView");
</script>

Conversion Script

The conversion pixel should only be fired on a successful conversion. We recommend a “thank you” page.

Values passed to the Corvidae Pixel in this example should be pulled from your Data Layer or otherwise supplied by the page template. The Conversion Script should not execute until those values are accessible by the following code.

HTML

Your Customer Success Manager will send you a plain-text version of this custom script during your onboarding.

CODE
<script type="text/javascript">
  cvqueue('addTrans', {
    conversionName: 'Sale', // The name of this conversion type e.g. 'Sale', 'Registration'
    orderId: String({{order id}}),
    currency: 'GBP', // Required. Currency code. Use 'GBP' unless otherwise instructed
    revenue: {{revenue}}, // Advised. Revenue value with 2dp
    tax: {{tax}}, // Optional. The tax value of this conversion with 2dp
    shipping: {{shipping}}, // Optional. The shipping value of this conversion with 2dp
    digitalProperty: 'yourwebsite.com', // Required. The property on which this conversion occurred
  });
  cvqueue('trackTrans');
</script>

Conversion: Variables

For non-transacting conversions, such as a registration or newsletter subscription.

Variable Name

Description

Required

order id

A unique ID for the conversion. This is used to deduplicate repeat conversions so must persist if the user visits the same page in the future.
If no order id is supplied, we apply a unique UID to every call, which may result in duplication of conversions.

REQUIRED

conversionName

The name of the Conversion Type, as found in your Corvidae account. If you are unsure please speak to your Customer Success Manager.

REQUIRED

digitalProperty

The identifier for the property on which the conversion occurred, as found in your Corvidae account. If you are unsure please speak to your Customer Success Manager.

REQUIRED

Transaction: Variables

As with all Conversions, Transactions require a unique order id, conversionName, and digitalProperty, for deduplication but additionally support a number of financial metrics described below.

Variable Name

Description

Required

revenue

The total monetary value of the transaction. e.g. 1066.91

ADVISED

tax

The total tax paid on this transaction. e.g. 10.49

OPTIONAL

shipping

The total cost of shipping for this transaction. e.g. 1.86

OPTIONAL

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.