DailyStory .NET SDK

The DailyStory .NET SDK is an open source library hosted on GitHub used by .NET developers to integrate DailyStory's capabilities into their .NET application.

DailyStory Web Forms

DailyStory Web Forms enable you to create, design and manage web forms within DailyStory. You can then include those forms within your web application to request information from visitors, such as a signing up for a newsletter.

A web form is part of a DailyStory campaign and once a form is submitted the contents are used to either create a new lead within a campaign or add to an existing lead.

How to include a Web Form in ASP.NET

To include a DailyStory Web Form in your existing ASP.NET application, follow these steps:

  1. Add the .NET SDK Library

Either compile the .NET SDK yourself, or use the pre-compiled DailyStory.SDK.DotNet.dll library included with the SDK, and include it in the \bin folder of your ASP.NET application.

  1. Get your DailyStory Site Id

Find your DailyStory Site Id, as this will be required to use the .NET SDK. You can find your Site Id on the Tracking Code page in your DailyStory application. DailyStory Site ID and Tracking Code page

  1. Get your DailyStory Web Form ID

Next, get the Unique Id of the DailyStory Web Form you want to include. You can find your Web Form Unique Id by clicking on any Web Form.

Web Form Unique Id

  1. Call the WebForm API

Open or create an ASP.NET page and include a reference to the DailyStory.SDK.DotNet and render the web form using the static RenderWebForm method:

@using DailyStory.SDK.DotNet
<h1>Hello world!</h1>
@Html.Raw(WebForm.RenderWebForm("[Your Site Id]", "[Your Web Form Id]"))

Replace [Your Site Id] and [Your Form Id] with the values from your DailyStory application from step 2 and step 3.

When you run this page, you should see something similar to this:

Simple Web Form

Next, let's add some simple style and JavaScript to improve this web form.

Read more details about styling your web form

To make things simple, DailyStory uses Bootstrap class names in the CSS. While not required, this means that you can quickly use the Bootstrap framework to immediately make your form responsive and adaptive (i.e., mobile friendly).

DailyStory also provides an optional JavaScript library that automatically takes care of things like Google reCAPTCHA support (when enabled) and client-side form validation.

Important - the optional JavaScript library provided by DailyStory requires jQuery.

Finally, DailyStory additionally provides some pre-built CSS files to add form validation and basic styling. These are completely optional:

@using DailyStory.SDK.DotNet
	<script src="https://code.jquery.com/jquery-3.2.1.min.js"
    <script type="text/javascript" src="https://cms-1.dailystory.com/Scripts/ds-landingpages.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" id="ds-webform-css" href="https://cms-1.dailystory.com/Content/base_webform.css?ver=1.0.2" type="text/css" media="all">
<h1>Hello world!</h1>
@Html.Raw(WebForm.RenderWebForm("[Your Site Id]", "[Your Web Form Id]"))

Now our web form looks a little nicer:

Simple Web Form

There are several pre-built CSS templates to choose from. For example, if you want a simple horizontal form you can replace the base_webform.css with base_webform-horizontal.css and change the Web Form Layout to Hide Form Labels:

Simple Web Form

More Examples

If you would like to see more examples please see our .NET Example Application in the SDK.