Getting button to connect to cutstom code

  • 5 February 2019
  • 4 replies
  • 24 views

I’m using Chargebee to build a subscription service and recently received two snippets of code from them:

1-I put this one into the header already: <script src="https://js.chargebee.com/v2/chargebee.js" data-cb-site="companyname-test" ></script>

2-And then I opened up a custom HTML box and put this in: <a href="javascript:void(0)" data-cb-type="checkout" data-cb-plan-id="copy_of_engage-newsletter"> subscribe </a>.

that got me a tiny little “Subscribe” link…not what I’m looking for.

So here’s my question: How can I get the #2 code above into an Unbounce button? When I create a button in Unbounce, it seems like my only option is to include a URL, and the code Chargebee has given me…well, doesn’t seem to be a URL exactly…

Thanks in advance!


4 replies

There’s no code visible here. To post code on the forum you need to indent it with 4 spaces. Alternatively you can press the </> button in the editor.

Thanks! Just changed it now. Would welcome feedback!

I’ve done some digging but it seems like it’s not possible in Unbounce to add those data attributes (data-cb-type and data-cb-plan-id). I think you will have to add styles to your anchor link to make it look like a button. Alternatively, you could look in to what styles/classes you get when you’re using a standard Unbounce button and try to apply those to your HTML box code.

Feel free to share a link to your page, that might help.

Userlevel 7
Badge +3

Hi @jrrogers625,

You can do it and Chargebee even provides most of the JS you’ll need to accomplish it.

Here is the relevant documentation from their site.

You would just have to adjust it for the particular Unbounce button you want to use.

Best,
Hristian

Reply