All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.dynamic_include.top_head.jsp Maven / Gradle / Ivy

There is a newer version: 3.0.99
Show newest version
<%--
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */
--%>

<%@ include file="/init.jsp" %>

<%
SegmentsExperiment segmentsExperiment = (SegmentsExperiment)request.getAttribute(SegmentsExperimentWebKeys.SEGMENTS_EXPERIMENT);
%>


	
		var elements = [];

		var targetableCollectionElements = document.querySelectorAll(
			'[id^=analytics-targetable-collection]'
		);

		if (targetableCollectionElements.length) {
			targetableCollectionElements.forEach((element, index) => {
				if ('#' + element.id === '<%= segmentsExperiment.getGoalTarget() %>') {
					elements.push(element);
				}
			});
		}
		else {
			elements.push(
				document.querySelector('<%= segmentsExperiment.getGoalTarget() %>')
			);
		}

		if (elements.length) {
			elements.forEach((element) => {
				element.addEventListener('click', () => {
					if (window.Analytics) {
						Analytics.send('ctaClicked', 'Page', {elementId: element.id});
					}
				});
			});
		}
	




© 2015 - 2024 Weber Informatics LLC | Privacy Policy