Multiple pages website
A website where the whole HTML page is reloaded when the user goes from one page to another (as opposite to Single Page Application)
Script integration
The script can be included with the auto parameter, so that the data collection can start without any other development:
...
<script src="<%= signalCollectorUrl %>/api/v2/tenants/<%= tenantId %>/scripts?auto=1"></script>
...
First View of a Use Case
Nothing to do when the Use Case starts as we have set the auto parameter to 1.
Then, just before the user leaves the page, the following method has to be called. This method sends the latest information about this page to the signal collector:
...
<button type=”submit” onClick=”ifp_finalizeView(visitId, function(){return true});” />
...
All other pages of the Use Case
If the Use Case contains one page only, the frontend integration is complete.
If the Use Case contains several pages, then the script has to be included in each page with the previously generated visitId set as parameter:
...
<script src="<%= signalCollectorUrl %>/api/v2/tenants/<%= tenantId %>/scripts?auto=1&visitId=123456-789456"></script>
...
Optionally, you can also set the partners parameter to control which partner you want to includes depending on the page. Then, as for the 1st page, just before the user leaves the page, the following method has to be called:
...
<button type=”submit” onClick=”ifp_finalizeView(visitId, function(){return true});” />
...
Note
As ifp_initView method is called automatically, we provide an other way of sending partners configuration for this case. This is by declaring a global variable called ifp_params before inserting our script: ifp_params