Solve SDK
Enabling the Solve SDK on your Shopify site allows Solve to accurately track your customers. Customer session and page-view data acquired from the SDK identifies your customers and the actions they take when visiting your store.
Access the Solve platform, enter Settings, then General. Copy the Solve SDK and paste it into the theme.liquid
file for your Shopify store. The SDK should be placed directly above the closing <head>
tag. If you use an external code repository such as Github or Gitlab, remember to add the SDK to your theme there also.
The Solve JS SDK is a web SDK that runs in the browser. It communicates with the Solve platform in order to collect pageviews, custom events, and identity information from users as they browse merchant sites.
When an anonymous user visits the site for the first time, the Solve SDK will generate a local session and identity first party cookie tracking the user. When the user is identified, a profile will be created and session data will be linked to their profile. This data is connected to their onsite behavior, giving end-to-end insight into a user’s full journey and history on the site.
How users are identified
Method | Description |
Email | The user clicked on an email and visited the website. Solve identified the session based on unique parameters passed with the URL. This is typically through a regular email campaign or a cart abandonment email. |
Form Capture | The user filled out an email or contact form onsite. Solve identified the session automatically through the form. The Solve JS SDK being on the site enables this capture. |
Checkout Capture | The user filled out their contact details in the checkout process. Solve identified the session automatically through the form. |
Identity Event | A custom event was sent from Solve’s JS SDK which contained identifying information. |
In order to ensure that the Solve JS SDK is able to link anonymous session data to the identified profile, JS snippets must be placed on the forms.
For Developers
The Solve SDK enables you associate a user to their actions and behaviors. It includes a unique User ID and any optional attributes you want to capture.
Identifying a User
The identify
call is used to capture customer information and should be used any time you get an identifying signal from a user such as on a sign up form or user login.
You can pass customer information in the payload for first_name
, last_name
email
and phone
. We strongly recommend using E.164 standard format for phone numbers. At very least an email
is required for Solve to create a profile, all other information is supplementary.
To add optional additional information to a user profile use the custom
field which accepts key value pairs and stores information on profile in the custom_attributes
field.
Example
slv.identify(
{
first_name: "John",
last_name: "Smith",
email: "John@example.io",
phone: "123123123"
},
{ "attribute_name": "attribute_value",
"attribute2_name": "attribute2_value"
}
)
Custom Events
Solve can track custom events where a user take a specific action. For example to track that a user clicked a specific button on a landing page.
slv.custom("landing-page-signup",
{ "attribute_name": "attribute_value" })
The Solve SDK automatically tracks pageviews but if you are developing a single page app you may need to fire a pageview event when you load a new page. You can pass any custom attributes for the pageview through using the custom
argument.
slv.pageView({ "attribute_name": "attribute_value" })
If you have a single page app or headless you will need to associate the cart with the user. To do this use the identifyCart helper and pass through the cartId and we’ll associate the cart with the browsing behavior of the user and associate any orders with the session.
slv.identifyCart("1234")
To capture a form signup manually you can use the formCapture
helper which you can use to understand the exact form the user was acquired, with this helper you can pass any additional attributed you want to store on the profile from the form field and pass it through the custom attributes. For example
slv.formCapture(
{"url": "https://example.com/landing-test-1", "form_type": "shopify" },
{ "attribute_name": "attribute_value" }
)