Techdocs
  • Introduction
  • Implementing Nosto
    • Implement on your website
      • Manual Tagging - Essentials
        • Setting up your account
        • Adding the Nosto Script
        • Adding the Cart Tagging
        • Adding the Customer information
        • Adding the Product Tagging
          • Default Product Tagging
          • Basic Tagging
        • Adding the Category/Brand Tagging
        • Adding the Search Tagging
        • Adding the Order Tagging
        • Defining Nosto placements
        • Tagging your page types
      • Advanced Usage
        • Extending tagging with SKUs
        • Adding support for multi-currency
        • Adding support for customer group pricing
      • FAQ
    • Implement on native mobile
    • Implement on a physical store
    • Implement Search & Categories
      • Using Search Templates
        • Using Search Templates
        • Implementing Search page
        • Implementing Autocomplete
        • Implementing Category pages
        • Testing & deployment
        • FAQ
      • Using the API
        • Use the Search & Categories API
        • Implement Search results page
        • Implement Autocomplete
        • Implement Category pages
        • FAQ
      • Using the JavaScript Library
        • Implement Autocomplete using the Nosto Autocomplete library
          • Installation
          • Initialization
            • Render results
            • Submit search
          • Create Autocomplete template
          • Further reading
    • Check your setup
    • Template customization
      • Starting points
      • Product cards
      • Styling
      • Scripting
  • APIs
    • GraphQL
      • The Playground
      • Using the API
      • Testing and Debugging
      • Using Mutations
        • Updating Products
        • Updating Categories
        • Updating Identities
        • GraphQL: Onsite Sessions
        • Working with Orders
          • GraphQL: Placing Orders
          • GraphQL: Updating Order Statuses
      • Using Queries
        • Querying Products
        • Querying Identities
        • Querying Orders
        • Querying Recommendations
        • Querying Segments
        • Querying Search
        • Querying Category Merchandising Products (CM 1.0)
      • For iOS & Android
      • For Headless
    • REST
      • GDPR
        • Redacting customer data
        • Initiating data takeouts
      • Customers
        • Blacklisting Customers
        • Toggling marketing consent
      • Products
        • Updating Products
        • Discontinuing Products
        • Recrawling Products
      • Other
        • Updating Rates
    • Frontend
      • Session API
        • Terminology
        • Setting up
        • Managing Sessions
        • Handling Placements
        • Tracking Events
        • Leveraging Features
        • Record Attribution
        • Advanced Usage
          • Supporting opt-out and do-not-track
          • Using external session identifiers
          • Adding support for multi-currency
          • Adding support for customer group pricing
        • FAQ
      • JS API
        • Initializing Nosto
        • Recommendations
          • Loading Recommendations
          • Recommendation Callbacks
          • Setting up dynamic filtering
          • Sending Product-View Events
          • Sending Add to Cart-Events
        • Popups
          • Listing Popup Campaigns
          • Opening a Popup
          • Enabling & Disabling Popups
          • Popup Callbacks
        • Advanced Usage
          • Sending email addresses to Nosto
          • Manually segmenting users
          • Dynamically sending the cart content
          • Sending Customer Information
        • Record Attribution
      • Open Source
        • Nosto JS
        • Search JS
        • Nosto React
        • Web Components
          • Loading Web components
  • User Generated Content
    • UGC Techdocs
  • 3rd party data integrations
    • Shopify
    • Magento 2
    • Magento
    • BigCommerce
    • Shopware 6
    • Shopware 5
    • Prestashop
    • Salesforce
    • PHP-SDK
Powered by GitBook
On this page
  • Parameters
  • Event Types
  • Event Ref Types
  • Examples
  • Attributing a placement click to a vp (View Product) event
  • Attributing a placement click to a cc (Custom Campaign) event
  • Adding the fourth refSrc parameter
  • Attributing a click inside a content campaign to a con (Content Campaign) event

Was this helpful?

Export as PDF
  1. APIs
  2. Frontend
  3. JS API

Record Attribution

The recordAttribution method provides a low-level standalone API to submit events to Nosto for processing in the backend. It is to be used for a standalone attribution submission that is not covered by the alternatives:

  • Parameterless attribution usage

  • The usage of attribution URL parameters

  • The Session API

  • The Request API (api.createRecommendationRequest)

nostojs(api => api.recordAttribution({ 
  type: "vp",
  target: "6829460553806", 
  ref: "191666803", 
  refType: "cmp" })
  .done() 
)

The API method recordAttribution accepts one event at a time, but users can chain multiple calls to recordAttribution and add as many events as they want.

Parameters

name
field type
is required
description

type

string

yes

target

string

yes

id of the element that's been loaded as a result of the event

ref

string

no

id of the element that hosted the link which triggered the event

refSrc

string

no

id of parent element of the link that triggered the event

targetFragment

string

no

the skuId in case of `vpevents

refType

string

no

Event Types

Nosto supports following predefined event types

Type
Description

View Product (VP)

An event associated with viewing a single product

View Category (VC)

An event associated with event a single category of items

Internal Search (IS)

An event associated with results of search internal to a merchant's website

Add to cart (CP)

An event associated with adding a product or bundle to a cart

External Campaign (EC)

Custom Campaign (CC)

An event associated with campaigns, which are not part of nosto, that directed a user to a merchant website. These campaigns will not contain google's UTM parameters in ev1 request URL

External Search (ES)

An event associated with search outside of merchant's website (Google for e.g.) that brought the user to merchant's website

Give Coupon (GC)

An event associated with a coupon code campaign popup in which the customer has acted upon

Source (SRC)

An event associated with a customer action which needs to be attributed to one of Nosto's feature (api, email, rec, imgrec, cmp). Here the information is usually passed through a pre-configured source parameters name (nosto_source, by default) in ev1 request URL

Cart Popup Recommendations (CPR)

An event associated with a recommendation, that's shown when a product is added to cart, in which a customer has acted upon

Page Load (PL)

An event associated with a page load merchant's website

Content Campaign (CON)

Event triggered when a customer performs an action inside a content campaign

Event Ref Types

The refType (reference types) parameter is introduced as a replacement for Nosto's legacy srcevent. It's specifies the type of source (Nosto feature) that contributed to the attribution. The table below lists all possible reference types

Ref Type
Description

email

Triggered email

imgrec

Email widgets

rec

Onsite recommendation (Nosto recommendation template)

api

API recommendations (Session/JS API)

oc

Onsite campaigns

cmp

Category merchandising

os

Onsite search

Examples

Attributing a placement click to a vp (View Product) event

nostojs(api => {
  api
  .recordAttribution({ type: "vp", target: "12345678", ref: "frontpage-nosto-1" })
  .done()
});

In the above example,

  • vp specifies the type of event and it corresponds to View Product

  • 12345678 specifies the target and it corresponds to the ID of the product that's being viewed

  • frontpage-nosto-1 specifies the slot’s ID from the placement that hosted the product that’s being clicked

Attributing a placement click to a cc (Custom Campaign) event

nostojs(api => {
  api
  .recordAttribution({ type: "cc", target: "12345678", ref: "frontpage-nosto-1" })
  .done()
})

In the above example,

  • cc specifies the type of event and it corresponds to Custom Campaign

  • 12345678 specifies the target and it corresponds to the ID of the product that's being viewed

  • frontpage-nosto-1 specifies the slot’s ID from the placement that hosted the product that’s being clicked

Adding the fourth refSrc parameter

nostojs(api => api
  .recordAttribution({ type: "vp", target: "7513863258337", ref: "productpage-nosto-3", refSrc: "7513872007393" })
  .done()
})

In the above example,

  • vp specifies the type of event and it corresponds to View Product

  • 7513863258337 specifies the target and it corresponds to the ID of the product that's being viewed

  • productpage-nosto-3 specifies the slot’s ID from the placement that hosted the product that’s being clicked

  • 7513872007393 specifies the reference source and it corresponds to the ID of the product displayed in current page (PDP), that contained the ref element, (productpage-nosto-3)

Here we are recording a View Product event for product 7513863258337 which was clicked from the recommendation slot productpage-nosto-3 while on another product page 7513872007393

Attributing a click inside a content campaign to a con (Content Campaign) event

nostojs(api => {
  api
    .recordAttribution({ type: "con", target: "6ef452da787623f2" })
    .done()
})

In the above example,

  • con specifies the type of event and it corresponds to Content Campaign

  • 6ef452da787623f2 specifies the target and it corresponds to the ID of the content campaign inside which a customer performs an action

In similar way, we will be able to record attribution for all the event types listed under Event Types section of this documentation.

PreviousSending Customer InformationNextOpen Source

Last updated 23 days ago

Was this helpful?

type of event to which a placement (ref) should be attributed. Refer

Refer

An event associated with campaigns, which are not part of nosto, that directed a user to a merchant website. These campaigns will contain google's UTM parameters ( for more info.) in ev1 request URL

Event Types
Event Ref Types
UTM parameters