Custom widgets and the Bitly API

I’m hoping someone can lend some custom widget guidance :slight_smile:

We are building a “Refer a Friend” program. I have a page in CM1 with an embedded Marketo form. On submit, the page directs to a new page with the form values as URL parameters. We are trying to use these URL parameters to build a unique URL for the member to forward to friends and family. The URL with all the required parameters is reeeeally long, and I want to use bitly to shorten it. 

Our web server is Windows and our apps run on .net. I haven’t successfully integrated any .net apps with CM1 though, I’m confused with how to integrate all of the parts in a project.

I’d love to do straight Js, but that exposes our access token, so it is not an option. I’m wondering if a custom widget might work? Would storing the authentication token info as an asset, or coding it into the widget, hide the token from the user?

Hi Lisa, 

Following best practices you’d want to have some server side code handling the authentication token in order keep that out of the client browser.

One solution would be to write the majority of the application in JavaScript within Percussion as a custom widget and make a call to an ASP script on your application server in order to process the URL shortening part securely.  The JavaScript call can send over the long URL for processing and the ASP script would return the shortened URL. 

If Percussion is publishing to a webserver that’s running the .NET framework then you can embed .NET code directly into Percussion pages by placing the code into HTML widgets on the page and wrapping the code in [—code—] tags. 

You can find more information on integrating Percussion and .NET application from this whitepaper:…

Let us know how you make out with this project!

@Piotr - when I received this email with .NET application link - I clicked that link from the email, not from the browser and took me 404 error -…

Is there a way to modify the email template and make sure the link are working properly? Thanks!

Thanks for the heads up Aaron! We’ll check that out and try to fix that soon.