SamCart
Configure the OptiPub SamCart Integration
OptiPub IntegrationsIntegrations 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
Add the optipub_effort_id custom field to SamCart Products
optipub_effort_id custom field to SamCart ProductsReturn to the main menu and open Products.
- Click the
Nameof a product.- Open the
Detailsview and scroll down 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.
- Open the
Repeat for each product that will have an Order Page created in OptiPub Landing Pages.
Map SamCart Products to OptiPub Publications
All Products Require Publication MappingAll
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
Embedding a SamCart Order Form in OptiPub Landing Pages
You can create and host order pages in OptiPub to process SamCart product orders. OptiPub is able to connect web ads, email text ads, and promos to order pages and track granular statistics for each effort using Campaigns.
OptiPub provides a SamCart Order Form component to easily embed order forms for SamCart products in OptiPub Landing Pages.
OptiPub Landing Page link URLs do not need the optipub_effort_id parameter. Order pages created in OptiPub will automatically insert the effort id into the embedded SamCart order form.
Integrating SamCart Orders with OptiPub Campaigns
OptiPub Effort IDs are created in OptiPub Campaigns. Create a Campaign and then Generate a Campaign Link to create an effort id to use for the
optipub_effort_idcustom field value.As always, make sure your SamCart Product has the
optipub_effort_idcustom field configured and the product is mapped to a publication .
Include the custom field optipub_effort_id=<effort_id> as a URL parameter in links to your SamCart order page for the SamCart order event to map the OptiPub subscription to a Campaign.
Example Samcart Link: https://secure.optipub.com/products/my-product-name?optipub_effort_id=123
If you use tracking links to redirect to your order page, make sure to include optipub_effort_id=<effort_id> in your tracking links, and that the tracking links pass the parameter to your SamCart order page.
Generating Campaign Links for SamCart Order Pages
Campaign links to External URLs for External Offers must include the optipub_effort_id=<effort_id> parameter to map the order and subscription back to an OptiPub campaign.
Campaign links to order pages hosted on OptiPub landing pages do not need the parameter. But if you are hosting promotional landing pages on OptiPub that link to an external order page, the links to the order page must have the parameter.
This requirement is only necessary to have OptiPub subscriptions mapped to a campaign. If an optipub_effort_id is not passed in your SamCart order form, the subscription will be created successfully, but with an N/A campaign.
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 |
Review SamCart Event Hook Logs
Navigate to OptiPub > Administration > System Settings > Integrations > SamCart [Logs]
OptiPub logs every webhook received from SamCart and timestamps created date and the latest failed processing attempt and retry attempt.
These logs are accessible from the OptiPub Integrations page. Logs can be filtered by event data, or by the date the log was Created, Failed, and Retried.
OptiPub will send a status response back to SamCart for each webhook, and SamCart will reattempt delivery once per day for up to 3 days if it does not receive a success status response.
If OptiPub fails to process an event, most likely the SamCart Product is not mapped to an OptiPub Publication.
After you create the mapping, you can retry the event.
Retrying a webhook event in OptiPub
You can retry any event by clicking Retry from the actions menu for the event log and OptiPub will attempt to process the event again to create or update the OptiPub subscription effected by the event.
T

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 Orders for Products not mapped to a Publication
If SamCart product orders are received before the product is mapped to an OptiPub publication, you can review logs from the integration page at OptiPub > Administration > System Settings > Integrations by clicking on the Logs link in the SamCart card.
before orders are received, you can , you can search for the product ID, and retry the Order events to create the OptiPub Subscriptions like normal.
Updated about 21 hours ago
