Inpage Subscribe / Unsubscribe from segments
If you want your website visitors to be able to subscribe or unsubscribe from a specific segment later, you can do this using Inpage Integration.
The following HTML file is intended as an example. The following values are transferred to Sovendus when this form is submitted.
- Segment: push_interessen
- Books
- DVDs
- Events
- Special offers
- Segment: push_club
- Yes
- No
<script>
<section>
<div class="gb-text">
<h1>Notification-Service</h1>
<div class="text">Subscribe to web notifications and stay informed about everything you need to know.</div>
<div class="gb-select">
<form id="gb-select-form">
<div class="gb-select-interests">
<div class="gb-select-headline">
What can we inform you about?
</div>
<div class="form-check form-check-inline">
<!-- Define the segment name with the attribute "name" (this will be communicated to you by your adfocus employee) and the existing segment values with the attribute "value". -->
<input class="form-check-input" type="checkbox" id="gb-select-form--1" name="push_interessen" value="Books" checked="">
<label class="form-check-label" for="gb-select-form--1">Books</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="gb-select-form--2" name="push_interessen" value="DVDs" checked="">
<label class="form-check-label" for="gb-select-form--2">DVD's</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="gb-select-form--3" name="push_interessen" value="Events" checked="">
<label class="form-check-label" for="gb-select-form--3">Events</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="gb-select-form--4" name="push_interessen" value="Special offers" checked="">
<label class="form-check-label" for="gb-select-form--4">Special offers</label>
</div>
<div class="gb-select-headline">
Are you already in our club?
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="gb-select-form--7" name="push_club" value="Yes" checked="">
<label class="form-check-label" for="gb-select-form--7">Yes</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="gb-select-form--8" name="push_club" value="No" checked="">
<label class="form-check-label" for="gb-select-form--8">No</label>
</div>
</div>
</form>
<a class="mt-es-button-highlight2" href="#" onclick="updatePushSegments()">Save</a>
</div>
</div>
</section>
<script type="text/javascript">
// Function for saving / updating subscriber segments
function updatePushSegments(){
var inputs = document.querySelectorAll('#gb-select-form input'); // <-- Insert your own form selector
var tagValues = {};
for(var i = 0; i < inputs.length; i++){
tagValues[inputs[i].name] = (typeof tagValues[inputs[i].name] != 'undefined' && tagValues[inputs[i].name] instanceof Array) ? tagValues[inputs[i].name] : [];
if (inputs[i].checked){
tagValues[inputs[i].name].push(inputs[i].value);
}
}
for (var tag in tagValues){
gb_tag(tag, tagValues[tag], false, true, true);
}
}
</script>