Hello Hype-Experts, i need advice on a clicktag problem:
I am using the Axel Springer Export Script. This script adds a global clicktag wrapper into the index.html file. However, I need additional clicktag exits in the file. These elements execute the following JavaScript when clicked:
function clicktag1(hypeDocument, element, event) {
window.open(getUriParams.clicktag1, "_blank");
}
(+ clicktag2 + clicktag3)
Now, after the export, I have 4 clicktag exits because the background has been assigned the global clicktag.
What do I need to remove from the index.html file to delete the global clicktag? And is my approach correct to achieve the desired effect for the Axel Springer ad platform? Maybe someone with experience in this can help me as well.
I'm not an expert on Axel Springer, but is there any specific documentation you are looking at for this? I can at least be another set of eyes on documentation vs implementation.
thank you very much for your response. I have a client who wants to transition between four images in an online ad, but each image should have its own clicktag. The ad will be sent to the Axel Springer ad platform. Since your export script includes a global clicktag, I can't use it.
With a bit of magic and ChatGPT, I’ve created my own Springer export script. The following requirements must be met in the Hype file:
The IDs of the clickable elements must be 'clicktag', 'clicktag2', 'clicktag3', and 'clicktag4'. The JavaScript executed on click should look like this:
window.open(getUriParams.clicktag, getUriParams.target || '_blank')
...
window.open(getUriParams.clicktag2, getUriParams.target2 || '_blank')
… and so on.
As far as I can tell with my limited skills, the export script works. The clicktags also seem to be functioning... I think. However, I would be really happy if you could take another look at it. Thank you so much for your time and help!
I don't think this is going to work 100% how you want. There's a few issues that compound on each other, I'll try to break them down:
It looks like you're taking two approaches at trying to install exits, one is via adding a 'click' event handler on elements matching specific IDs (in insert_at_body_start) and the other is by trying to add href and target attributes to the element matching specific IDs (in insert_at_body_end). You really will want either one or the other.
The 'click' event handler method uses a window.open() call which is technically fine from a general perspective, but the PDF documentation example uses putting elements in an <a> tag and then setting the href/target attributes. However you're not putting the elements within an <a> tag so the href/target attribute setting doesn't do anything anyhow.
You're always using '_blank' as the target on the window.open() calls. For the href/target, you're only setting the target for all the items to be the getUriParams['target'] and not target2, target3 etc like how the docs show.
So basically I'd say:
If the window.open() method is okay, then remove the code in the insert_at_body_end block.
If you do need to actually use <a> tags, then it isn't as easy of a change. You can't really change the hierarchy to insert these since Hype expects a very specific DOM. Instead the way to go would probably be to make elements in Hype with the Inner HTML having an <a> tag with your specified ID, and probably have that use a width/height of 100% or something to take up the size of an element.
If _blank is okay as a target always then you don't need to do anything. If it is expected that you use the targets, then you'll need to do so.
So it doesn't surprise me that it mostly works, but there are some minor points that may need to be addressed. Does that help out?
Thank you so much for taking the time to analyze my solution. I deleted the code in the insert_at_body_end block and had the ad management check it, just hoping for the best. And surprise… everything was okay on their end. I know this isn’t an elegant solution due to my limited knowledge, but as long as it works, I can live with it
Once again, thank you so much for your help. Your software is worth every penny, and your support is invaluable!
I'm happy to help -- realistically there are tons of oddities in getting ads working with all the systems so having these pubic posts of figuring it all out is good for other folks that will no doubt encounter the same issues. Thank you .