Skip to content
Feralin

Developers

Shopify: quickstart

Install and first-use steps for sending events to Feralin with Shopify. Code samples come from the SDK's own README and statuses from the capability record.

Install

A package published on Shopify App Store has not been verified yet; the steps below install from source or from a local package.

<script src="https://feralin.com/sdk/feralin.iife.js" defer></script>
<script>
  (function () {
    var hazir = false;
    function izniUygula() {
      var gizlilik = window.Shopify.customerPrivacy;
      feralin.setConsent({ analytics: gizlilik.analyticsProcessingAllowed(), advertising: gizlilik.marketingAllowed() });
    }
    window.feralinOlay = function (ad, ozellikler) {
      if (!hazir) return null;
      var kopya = Object.assign({}, ozellikler);
      if (feralin.getStatus().consent.advertising !== true) delete kopya.fr_click;
      return feralin.track(ad, kopya);
    };
    window.addEventListener("load", function () {
      feralin.initialize({ projectKey: "pk_live_BURAYA", collectUrl: "https://feralin.com/collect" });
      hazir = true;
      window.Shopify.loadFeatures([{ name: "consent-tracking-api", version: "0.2" }], function (hata) {
        if (hata) return;
        izniUygula();
        document.addEventListener("visitorConsentCollected", izniUygula);
      });
    });
  })();
</script>

First use

var izin = init.customerPrivacy;
api.customerPrivacy.subscribe("visitorConsentCollected", function (olay) {
  izin = olay.customerPrivacy;
});

analytics.subscribe("checkout_completed", function (olay) {
  if (!izin.analyticsProcessingAllowed) return;
  var odeme = olay.data.checkout;
  if (!odeme.order || !odeme.order.id) return;
  var kimlik = ("shopify-" + odeme.order.id).replace(/[^0-9A-Za-z-]/g, "-").slice(0, 64);
  fetch("https://feralin.com/collect/v1/batch", {
    method: "POST",
    keepalive: true,
    headers: { "Content-Type": "application/json", "X-Feralin-Project-Key": "pk_live_BURAYA", "Idempotency-Key": kimlik },
    body: JSON.stringify({
      events: [
        {
          event_id: kimlik,
          event_name: "order_completed",
          occurred_at: new Date().toISOString(),
          platform: "other",
          schema_version: 1,
          consent: { analytics: true, advertising: izin.marketingAllowed === true },
          properties: {
            order_id: String(odeme.order.id),
            value: odeme.totalPrice ? odeme.totalPrice.amount : undefined,
            currency: odeme.totalPrice ? odeme.totalPrice.currencyCode : undefined,
          },
        },
      ],
    }),
  });
});

Code samples are taken as they are from docs/sdk/no-code.md; comments inside may be in Turkish. You create the project key in the dashboard.

Capabilities

Shopify capability status
CapabilityStatus
Event sendingPartial
Batch sendingPartial
Consent handlingPartial
IdentityPartial
AttributionPartial
Deep linksNot applicable
RevenuePlanned
Error captureNot applicable
Session replayNot applicable
TracingNot applicable

Verification chain

Shopify verification chain
LinkStatus
SourcePartial
BuildNot applicable
TestPassed
Registry publicationWaiting for external access
Clean installWaiting for external access
Event receiptPartial
DocumentationPassed
Super Admin proofNot started

Passed means local evidence: source, build and tests ran. Registry publication and Super Admin proof are separate links; the SDK is not called ready until each has passed.