Well, that would be the only way, if you do not want the identifier on the page you could also have a hidden range, provide this module moduleid, then add moduleid to the data-moduleid of the data attribute and then read it using jquery
<span class="moduleid" data-moduleid="<%=ModuleControl.ModuleContext.ModuleId%>"></span>
source share