SamCart
Configure the OptiPub SamCart Integration
OptiPub Integrations
Integrations can be found in OptiPub > Administration > System Settings > Integrations
Activate the SamCart Integration in OptiPub
To activate OptiPub's SamCart Integration you will need a SamCart API Key and Subdomain.
Gather Information from SamCart
API Key
Email [email protected] to request an API Key for your account. Review the SamCart API SamCart documentation for more information.
Subdomain
Login to your SamCart Account, and open Apps in the menu. Copy your subdomain from the URL (https://app.samcart.com/marketplace/{YOUR_SUBDOMAIN}/apps).
Example URL:
https://app.samcart.com/marketplace/optipub/appsExample Subomain:
optipub
Configure OptiPub SamCart Integration
- Navigate to
OptiPub > Administration > Integrations > SamCartand click Add +. - Fill in your
API KeyandSubdomain. - Toggle
Enable SamCarton. - Copy the
Webhook URLthat appears. - Click Save.
Configure SamCart
Configure the Webhooks App
Review the Using Webhooks on SamCart SamCart documentation for more information.
Connect the OptiPub Webhook URL to SamCart
- Login to your
SamCart Account, and openAppsin the menu. - Explore
Otherapps, and click Install in theWebhookscard. - Paste the OptiPub
Webhook URLinto theNotify Urltext input. - Click Connect.
If Webhooks are already installed, click Open App on the Webhooks card, then click the 3-dot
Optionsmenu in the top right and click Connect New App Instance.
Confirm Connection
Scroll down to the Logs section of the Webhooks App, and select Configuration logs.
An Integration successfully connected/refreshed. log should exist for the Connect App action. If no log is present, click Refresh Logs.
Add Global Rules to Webhook App
Add these Global Rules to the Webhooks App. Repeat for each trigger listed in the Triggers table below.
- Select
Globalin theRulessection. - Click + Add New Rule
- Select the Global Rule rule type.
- Select the Send Notify Url POST action.
- Select a
Triggerfrom the table below. - Click Add Rule.
| Triggers |
|---|
| Product Purchased |
| Product Refunded |
| Product Partially Refunded |
| Subscription Canceled |
| Subscription Started |
| Subscription Restarted |
Configure SamCart Settings
Open SamCart Settings from the bottom of the main menu.
Add Custom Fields
Review the Custom Fields SamCart documentation for more information.
Open Custom Fields from the Settings menu.
Create a custom field named optipub_effort_id.
- Click New Custom Field
- Set
Internal Field Nametooptipub_effort_id. - Set
Checkout Page LabeltoOptiPub Effort ID. - Set
Field TypetoHidden Value. - Click Save.
- Set
After saving, SamCart will automatically set a Slug name for the field.
Add OptiPub Tracking to SamCart Checkout Pages
Review the Pixels and Custom Conversion Tracking SamCart documentation for more information.
Open Tracking & Pixels from the Settings menu.
Paste the following into the Embed HTML/Scripts in Header then Save Changes.
<script src="https://assets.optipub.com/frontend/js/samcart-tracking.js"></script>
Maintaining the OptiPub SamCart Integration
Procedures in this section are required for all existing products, and new products added to SamCart.
Update SamCart Product Settings
Products that Require Custom Field
SamCart Products require the
optipub_effort_idcustom field when the product usesSamCart Order Formsembedded in OptiPub Landing Pages.
Return to the main menu and open Products.
- Click the
Nameof a product.- Scroll down in the
Detailsview to theCheckout Controlssection. - Click inside
Custom Fieldsso that a dropdown appears and select theoptipub_effort_idcustom field. - Click Save Changes.
- Click Back to Product List.
- Scroll down in the
Repeat for each product that will have an Order Page created in OptiPub Landing Pages.
OptiPub Order Pages will automatically insert the effort ID into the hidden
optipub_effort_idfield of theSamCart Order Form.The SamCart
Tracking & Pixelssetting in the previous section must be configured with the embedded header script.The effort ID inserted will allow OptiPub to integrate SamCart purchase event data with OptiPub Campaigns.
Map SamCart Products to OptiPub Publications
All Products Require Publication Mapping
All
PublishedSamCart Products must be mapped to a corresponding OptiPub Publication.This mapping is required for OptiPub to accurately process subscription and product webhook events received from SamCart.
OptiPub syncs all
Published,Test Mode, andArchivedproducts.
- Navigate to
OptiPub > Administration > Publications.- Edit the
Publicationusing the 3-dot action menu in the table. - Continue to the
Additional Informationstep. - Click on
SamCart Productsin theSamCart Mappingsection to display the products dropdown list. - Select each
SamCart Productbelonging to theOptiPub Publication. - Click Save.
- Edit the
Finding SamCart Products:
OptiPub
- OptiPub displays the SamCart
Product ID and Name.- The dropdown list is sorted by product ID.
- Type a name or ID in the product area to filter the available products in the dropdown.
SamCart
- Product search will work using the product ID displayed in OptiPub.
- Use a consistent naming scheme to organize products.
- Optional: Filter Products using
Tagsto review.
Using the SamCart Integration
Create SamCart Variables in OptiPub
When a SamCart product purchase triggers a webhook, it sends customer fields from the order form to OptiPub. To store the customer data in OptiPub, create variable names that match the webhook’s customer fields.
Create these OptiPub Variables to store SamCart order form data to the OptiPub Subscriber:
| OptiPub Variables |
|---|
| name |
| first_name |
| last_name |
| phone_number |
| customer_id |
| SamCart Custom FIeld Names |
SamCart Webhook Retries
If OptiPub does not respond successfully to a webhook, SamCart will reattempt delivery once per day for up to 3 days. OptiPub logs every webhook received from SamCart, and timestamps the latest failed processing attempt and retry attempt.
If OptiPub failed to process an event, most likely the product is not mapped.
You are able to View, Search, and Retry webhook logs from the SamCart integration.
Navigate to OptiPub > Administration > System Settings > Integrations > SamCart [Logs]

SamCart Webhook Logs
Search the Data field by email, product ID, or any other value sent in the webhooks. The Failed, Retried, and Created date values can be filtered by date range.
Retry Existing Orders from Before Mapping a Product to a Publication
If SamCart sends a product purchase webhook to OptiPub before the product is mapped to a Publication, you can search for the product ID, and retry the Order events to create the OptiPub Subscriptions like normal.
Updated 3 months ago
