Custom Integration

Custom Integration

Use this installation method if you don't use one of the standard shop platforms.

Include the following DIVVIT Javascript snippet on each page

1

Required: Install the main tracking script

Insert the following code right underneath the opening <body> tag:

<script type="text/javascript"> !function(){var t=window.divvit=window.divvit||[];if(t.DV_VERSION="1.0.0",t.init=function(e){if(!t.bInitialized){var i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("async",!0),i.setAttribute("src","https://tag.divvit.com/tag.js?id="+e);var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(i,n)}},!t.bInitialized){t.functions=["customer","pageview","cartAdd","cartRemove","cartUpdated","orderPlaced","nlSubscribed","dv"];for(var e=0;e<t.functions.length;e++){var i=t.functions[e];t[i]=function(e){return function(){return Array.prototype.unshift.call(arguments,e),t.push(arguments),t}}(i)}}}(); divvit.init("YOUR_FRONTEND_ID"); divvit.pageview(); </script>
Copy to clipboard
2

Optional: Transmit additional visitor information

In case the visitor is logged into his or her account, you can transmit this information in a separate function call to Divvit to enhance cross-device tracking abilities.

<script type="text/javascript"> [... see above ...] divvit.init("YOUR_FRONTEND_ID"); divvit.pageview(); divvit.customer({ // all these fields will be used to identify this logged-in user // you can specify as many fields as you need to uniquely identify a user // typically, the email address or customer ID should be enough email: "david@smith.com", customerId: "123456" // ... }); </script>
Copy to clipboard

Include individual Javascript calls on different page types

1

Required: Send information about placed orders

The following code should be placed on the page which the customer reaches after an order has been placed successfully ("thank you" page, or checkout success page).

<script type="text/javascript"> [ ... see above ... ] divvit.init('YOUR_FRONTEND_ID'); divvit.pageview(); divvit.orderPlaced({ order: { /* products that have been ordered */ products: [ { /* ID of this product in your shop system */ id: "13151", /* name of the product */ name: "Some cool product", /* category tree for this product */ category: ['Women', 'Shoes', 'Boots'], /* price incl. VAT, without shipping (product only) no currency symbol, American number formatting */ price: "19.99", /* [Optional] three letter currency code according to ISO 4217. If currency code is not submitted here, a standard currency code for this merchant site will be applied automatically. */ currency: "USD", /* [Optional] quantity if this product has been ordered more than once alternatively you can also list the same product twice instead of setting quantity to 2 */ quantity: "2" }, { /* see above */ id: "15512", name: "Another cool product", category: ['Men', 'Shirts', 'Dress shirts'], price: "29.99", currency: "USD" } ], /* [Required] The identifier you use to identify this order in your shop system */ orderId: "abc1234", /* [Required] Total gross amount incl. shipping cost, payments fees, VAT, and after vouchers have been applied. No currency symbol, American number formatting. */ total: "99.99", /* [Optional] Total amount of order before shipping, payment fees, voucher and VAT have been applied. In other words, the sum of all product prices net of VAT. */ totalProductsNet: "77", /* [Optional] Three letter currency code according to ISO 4217. If currency code is not submitted here, a standard currency code for this merchant site will be applied automatically. */ currency: "USD", /* [Optional] Shipping charges incurred for this order, including VAT */ shipping: "6.99", /* [Optional] Voucher code, absolute voucher value and voucher type for this order. Can be omitted in case no voucher was used. */ voucher: "PROMO-50", voucherDiscount: "9.99", // including VAT /* Voucher types: promo (promotional voucher), sorry (apology for problem in the past), refund (refund of previous order). */ voucherType: "promo", // If multiple vouchers are allowed in your shop, you can also pass them as an array: vouchers: [ { voucher: "PROMO-10", voucherDiscount: "19.99" }, { // ... } ] /* [Optional] If a payment fee has been applied for this order, please specify it here. Can be omitted when not applicable. */ paymentFee: "4.99", /* [Optional] Can be one of the following: paypal, credit-card, direct-debit, invoice, cash-on-delivery, other. */ paymentMethod: "credit-card", /* [Optional] Information about the customer who placed this order. This is required to identify follow-up orders of the same customer. You can specify one more more ID fields that uniquely identify this customer. */ customer: { idFields: { email: "david@smith.com" }, name: "David Smith" } } }); </script>
Copy to clipboard
2

Optional: Update products in cart

To track products that have been added to the cart, you can either go for an event-based approach or update the total cart each time the user adds or removes a product.

<script type="text/javascript"> // event-based: divvit.cartAdd({ /* [Optional] Identifier to identify this cart. If not provided, the a cookie will be used to identify the customer's cart. */ cartId: "123abc", product: { id: "123411", name: "Black shoe suede", category: ['Women', 'Shoes', 'Boots'], price: "122.99", currency: "USD", quantity: "2" } }); [...] divvit.cartRemove({ /* [Optional] Identifier to identify this cart */ cartId: "123abc", product: { id: "123411" } }); // OR update totals: divvit.cartUpdated({ /* [Optional] Identifier to identify this cart. If not provided, the a cookie will be used to identify the customer's cart. */ cartId: "123abc", products: [ { id: "13151", name: "Some cool product", category: ['Women', 'Shoes', 'Boots'], price: "19.99" }, { id: "15512", name: "Another cool product", category: ['Men', 'Shirts', 'Dress shirts'], price: "29.99", quantity: "2" } ], /* [Optional] Voucher code, absolute voucher value and voucher type for this order. Can be omitted in case no voucher was used. */ voucher: "PROMO-50", voucherDiscount: "9.99", /* Voucher types: promo (promotional voucher), sorry (apology for problem in the past), refund (refund of previous order). */ voucherType: "promo", // OR multiple vouchers: vouchers: [ { voucher: "VOUCHER_CODE1", voucherDiscount: "9.99" }, { // ... } ] }); </script>
Copy to clipboard

Tracking of traffic channels

The Google method

Since you might already have configured all your channels for reporting in Google Analytics, we do offer the possibility to simply use all of your pre-configured utm_source, utm_medium, utm_term, utm_content, utm_campaign parameters without any changes.

The DIVVIT method

If you are not yet tracking your traffic sources or want to switch your tracking to the DIVVIT method, then your should configure your redirect URLs in the following way:

  • dv_chgroup / dv_channel

    Whenever possible you should sort your traffic into the following channel groups (dv_chgroup) and channels (dv_channel). In case you are working with a channel that is not listed, you can create your own tag for it. Please stick to the provided channel groups, though.

    Channel groups:

    • sem: Paid search engine advertisements Available channels: google, yahoo, yandex, bing
    • social-ppc: Paid marketing on social media platforms Available channels: facebook, twitter, instagram, youtube, google, linkedin, pinterest
    • display: Display advertising Available channels: google
    • affiliate: Links inside affiliate programs Available channels: tradedoubler, zanox, webgains, cj, tradetracker
    • retargeting: Links for retargeting programs Available channels: criteo, adroll, mythings, sociomantic, rtb
    • email: Links in email marketing campaigns Available channels: tranaction, newsletter, external
  • dv_campaign Used to (optionally) identify a campaign inside a specific channel.
  • dv_group Used to (optionally) identify an ad group inside a campaign.
  • dv_keyword Used to (optionally) identify a keyword inside an ad group.