Marketing

Product video showcases in Go

A Go package that puts a store’s own videos beside the products they show. A showcase is a link to a video on YouTube or Facebook, the products in it, and which one is being shown now. The storefront plays the platform’s own player and sells through the ordinary cart. Nothing is uploaded, transcoded or streamed by the store.

What it does

In the package’s own words, a showcase is “a store’s own people showing the products it sells, in a video on YouTube or Facebook, beside those products”. A shop already films that for its social pages; the module lets the storefront show it next to those products and sell them through the ordinary cart.

A pasted address is checked against the share formats each platform documents and kept as a reference: YouTube’s video id, or Facebook’s canonical video address. The player’s address is built from that reference every time a showcase is read, so nothing a merchant types is put on a page as markup, and a change of embed format reaches every showcase at once.

The products are picked by hand, up to 50, or come from a collection read when the showcase is shown. A buyer sees only active products the request’s channel carries, in the request’s language, as a short summary: title, picture, the default variant’s price and compare-at price, and whether it can be bought. Cost, stock counts and metadata are left out.

A showcase is a recording or a livestream. The module does not claim more than it knows: a livestream reads “live” only after the store presses We’re live in the editor, and for twelve hours after. In the package’s words, “there are no viewer counts and no badges.”

Configuration

Nothing has to be set: the zero Config is what a store runs. All three fields are Go only, and there are no settings on the Plugins screen. Showcases themselves are made on the admin’s Content › Video showcases screen.

Video showcases module settings — 3 settings, 0 required
SettingEnvironment variableRequiredWhat it does
EventsPerMinute — No Bounds the views and clicks the store counts from one address for one showcase in a minute. Zero is 600. Go only.
YouTubeOEmbedURL — No Replaces YouTube’s oEmbed endpoint, https://www.youtube.com/oembed, which the link check asks. For tests; empty for production. Go only.
HTTPClient — No Replaces the client that asks YouTube. Otherwise the module uses the install’s outbound client with a five-second timeout. For tests; Go only.

The module reads its Config struct, not the environment. The variable names are the ones the package’s own example or the reference binary uses; in your own main() you choose where each value comes from. Where a setting has a panel label, the admin’s settings drawer can hold it too, and a value typed there wins over Config.

Setting it up

  1. Install the modulePass showcases.New to gocommerce.New, as below, or start the reference binary with -showcases. It adds five tables, and the Video showcases plugin starts switched on.
  2. Paste the video’s linkOn Content › Video showcases, paste the video’s own link. For a YouTube video the editor asks YouTube for its title and says if it is private or cannot be played on another site.
  3. Attach products and publishPick up to 50 products or a collection, choose where it appears (the home page, the pages of its products, its collection’s page) and publish. A showcase with no products cannot be published.
  4. Show it on the storefrontGET /x/showcases?on=home, ?product=<id> or ?collection=<id> lists the cards; GET /x/showcases/{slug} gives the player and the products. Report views, clicks and adds with POST /x/showcases/{slug}/events.

main.go

import (
	"github.com/itswadesh/gocommerce/core"
	"github.com/itswadesh/gocommerce/ext/showcases"
)

app, err := gocommerce.New(cfg,
	// EventsPerMinute bounds views and clicks from one address; zero means 600.
	showcases.New(showcases.Config{}),
)

The package doc has no example of its own; this is how the reference binary’s -showcases flag installs it. cfg is your gocommerce.Config. Import path github.com/itswadesh/gocommerce/ext/showcases.

How it works

What it does not do

Read these before an order depends on it. No store is known to run GoCommerce in production yet, so these come from the code, not from anyone’s experience.

FAQ

Questions about the Video showcases module

Does the store host the videos?

No. The video stays on YouTube or Facebook. The module keeps a reference to it and builds the platform’s own player from that reference, so there is nothing to upload and no video traffic through the store.

Which links can I paste?

A YouTube video’s own link (watch, youtu.be, live, shorts or embed), or a Facebook video’s address from the browser’s address bar (watch, video.php, reel, or a page’s videos). A channel, a page, or a short share link such as fb.watch is refused, with a message saying what to paste instead.

How does a livestream show as live?

Only when the store says so. Set the showcase’s kind to a livestream, give it a start time and press Scheduled to read “scheduled”, press We’re live when the broadcast starts and Ended when it stops. A broadcast left live reads as a replay after twelve hours.

What do the counts measure?

Views, clicks and adds to the cart, as the storefront reports them, per showcase per day, and the orders and revenue from baskets a showcase filled, each order counted once. Nothing about the buyer is stored.

Is this a YouTube or Facebook partnership?

No. The module embeds the players both platforms publish for other sites and asks YouTube’s public oEmbed endpoint about a link. Neither endorses GoCommerce, and no store is known to run this module in production.

Source

Everything on this page is read from ext/showcases in the GoCommerce repository, MIT licensed. When this page and the code disagree, the code is right and this page is out of date.YouTube and Facebook are trademarks of their owners; this module embeds their published video players and asks YouTube’s public oEmbed endpoint about a pasted link, and implies no endorsement. See trademarks.

Try it against a store of your own

The backend + admin quick start runs GoCommerce’s API and admin on your own machine, without a storefront. Add this module to it and try it on test orders before a real one depends on it.

Chat on WhatsApp