stock oEmbed is a mechanism to add stock transactions to existing web pages with ease. We currently support 4 methods of embedding.
- Embed a generated snippet from the Dashboard
- Wrap a ticker in custom markup
- Attach transaction action to your existing CTAs
- Using oEmbed payloads for oEmbed enabled sites
In all of these cases, you are required to add our embed script to the webpage using the following code -
<script async src="https://www.gateway-tt.in/assets/embed.js"></script>
- Go to Dashboard
- Add config for your intended transaction
- Click on 'GET CODE' and check the Preview
- Click on 'COPY CODE' to copy the snippet to your clipboard
- Paste the copied snippet in your HTML file
You can wrap tickers on your page in custom markup as shown in the following code. This will make the ticker hoverable. When the user hovers on the ticker they will see a popover with the details of the stock and a CTA.
<span class="sc-hover" data-cardsize="big" data-quantity="2" data-ordertype="BUY"> TCS </script>
- The span must have
- The element can have 3 optional data attributes
data-quantity= [number of stocks]
This method is similar to the one above. It adds an onClick handler to existing clickables (like buttons, anchors).
class="sc-hover"to your clickable
data-ticker="[stock ticker]"to the clickable
- Optionally add
data-ordertypeas described in the previous method
Visit the SC EMBED DEMO.
The script exposes a method
window.scEmbedController.load(). You need to call this method after your components are mounted to the DOM. In case of React, while using snippets from the dashboard, you need to add the snippet as
For WordPress, embedding smallcase cards can be as easy as pasting the link (URL) generated from the dashboard. But to enable this mechanism, you need to enable the stock oEmbed provider for WordPress. This can be done in 2 ways.
- Using our smallcaseEmbed plugin for wordpress
- Or, adding a few lines of code to your WordPress theme
We recommend this method of installing the plugin to enable oEmbed because that's easier and less error-prone.
To install and activate the smallcaseEmbed WordPress plugin, please follow the steps listed below.
- Download the smallcaseEmbed WordPress plugin (zip file).
- In your WordPress dashboard, open the Plugins section.
- Click the Add New button next to the heading Plugins at the top of the page.
- Click the Upload Plugin button next to the heading Add Plugins at the top of the page.
- Upload the smallcaseEmbed.zip in the file upload dialogue.
- Now the plugin will be installed and you will get a success/failure message in the next screen.
This method is not recommended. However, we will provide instruction for the benefit of advanced users.
- Open the folder containing the current theme of your WordPress site.
This can be done from the WordPress dashboard as well as from any file browser.
The themes are located in the wp-content/themes folder. Open the subfolder containing the current theme in use.
functions.phpof the current theme in your text editor of choice, this can be opened in the WordPress dashboard as well.
- Add the following snippet to the end of the
wp_oembed_add_provider( "https://www.gateway-tt.in/trade*", "https://www.gateway-tt.in/oembed"); wp_oembed_add_provider( "https://gateway-tt.in/trade*", "https://www.gateway-tt.in/oembed");
Updated about a month ago