Closed (fixed)
Project:
IVW Integration
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Oct 2018 at 20:28 UTC
Updated:
10 Nov 2022 at 13:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hideaway commentedThe following patch should do the trick
Comment #3
pagach commentedSince defer provides better performance, here's a patch using defer tag.
Comment #4
Andre-Bonly setting the ivw script to defer mode seems not to be sufficient for a working tracking setup.
ivw module places a block containing the targeting data like the following example
tracking is only done when window.iom is specified, which will be set by the js file being loaded, since that file loading will be defered and there's no wrapper around our tracking js
iom.c(iam_data, 1);, it simply won't be executed - not even an error will be produced since it's nicely wrapped.to fix this the ivw_block js should be wrapped with a event listener to only execute after window load event has been fired.
for reference: https://stackoverflow.com/questions/42950574/are-deferred-scripts-execut...
the file to be updated for this is templates/ivw-call.twig
Comment #5
Andre-Bit also might be a good idea to make this as an optional configuration. so a site builder can decide whether to use the defered method or inline tracking (since it might result in a small change in stats reported). Although in my humble opinion if a visitor exits your site before the site has been loaded it's should not be tracked in the first place.
Comment #6
jjchinquistSounds reasonable, patch created to:
The issue is with testing the various options, and is defer/async/nothing overkill?
Comment #7
Andre-BI don't think we should be using async since we can not predict when that's finished and we rely on data being inline injected for ivw. so defer / nothing will be the only options here. if defer is selected dom event listener wrapping is required. if nothing is selected dom event listener shall not be used.
with these two options I do not think it's overkill, because this is an external asset being called on every page load, slowing down page loading for every request.
in order to not break backwards compatibility default should be nothing.
Comment #8
jjchinquistGuess I have to clarify, I imagined having all options "defer/async/nothing" being an overkill for the site builder. Andre, your 2-option solution sounds more reasonable and testable.
Comment #9
aludescher commentedThis patch adds a checkbox for deferred script loading and uses 'DOMContentLoaded' event when deferred loading is enabled.
Comment #10
avpadernoComment #11
lucastockmann commentedReroll against
8.x-2.4-beta1Comment #12
daniel.bosenReroll against 8.x-2.4-beta5
Comment #13
daniel.bosenlooks good
Comment #15
daniel.bosenMerged, thank you!