Our Activator widget provides an ability to specify what the registration URL is that the activator widget will take you to. You specify this in Admin. Unfortunately, if your registration URL is of a more dynamic nature, a single URL specified in the configuration will not work for you.
Not to worry! There is another solution. Dynamically specify your URL when loading the widget. You'll need to come prepared to do a little scripting, but nothing too tricky.
Step 1: Switch to the alternative loading method
You've likely been given your widget loading code that includes some script like:
<div id="widget"></div>
<script
src="https://cdn.ingo.me/widgets-loader/1.4.4/js/ingo.loader.widget.js"
data-ingo-id="V0SQSLSSKSDSFYC3VZSKSDFJSDFLAMVC">
</script>
This script works fine to load the widget under normal situations. In order to dynamically modify the way the registration URL is specified though, you will need to use the "advanced" style loader. Ask InGo support if you need more details, but the more advanced loader style is a multi-line expanded script element, which will allow you to inject your dynamic-registration-url-construction code. The advanced code should look something like this:
<div id="widget"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://cdn.ingo.me/widgets-loader/1.4.4/js/ingo.loader.widget.js"></script>
<script>
$(function() {
$('#widget').loaderWidget({
"widgetId": "V0SQSLSFYC3VZMVCM4SYBMETHG30PYND"
});
})
</script>
Step 2: Create Your Custom URL
What you'll need to do is insert a little code just before the loaderWidget call, and then make a small modification to the loaderWidget call. Let's assume, for the purpose of this article, that you have some value in a drop down list (we'll call it "whichsubevent") that will be part of the registration URL. Maybe the user has to select one of a few different options before proceeding to registration, and what they choose determines which registration URL they'll be directed to. In our case we'll just add that as a parameter, but there's no limit to how complex your logic and URL construction can be, except maybe your scripting skill level.
To get this value, you can use some javascript like the following:
whichSubEventOption = document.querySelector("#whichsubevent").value;
registrationURL =
"https://reg.example.com/newreg?option=" + whichSubEventOption;
Step 3: Mix it All Together
You need to Place this BEFORE your loaderWidget call. In addition you would alter your loaderWidget call to include one new parameter, your registration URL. So the page content related to the widget would now look something like:
<div id="widget"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="//cdn.ingo.me/widgets-loader/1.4.4/js/ingo.loader.widget.js"></script>
<script>
$(function() {
whichSubEventOption = document.querySelector("#whichsubevent").value;
registrationURL =
"https://reg.example.com/newreg?option=" + whichSubEventOption;
$('#widget').loaderWidget({
"widgetId": "ABCDEFGHIJKLM0987654321",
"manual": registrationURL
});
})
</script>
That's it! Now when the activator widget redirects, it will redirect to the URL you've dynamically constructed.
You Control the Flow!
Happy Marketing!
Comments
0 comments
Please sign in to leave a comment.