Skip to content

Instantly share code, notes, and snippets.

View nikosantis's full-sized avatar
🏠
Working from home Chile

Nikolas Santis nikosantis

🏠
Working from home Chile
View GitHub Profile
var parentBody = document.getElementsByClassName("bodyclass")[0];
var observer = new MutationObserver(function (mutations, myObserver) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = mutations[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var mutation = _step.value;
document.addEventListener(
'wpcf7mailsent',
function (event) {
dataLayer.push({
event: 'formSent'
});
},
false
);
<!--Pegue este código tan alto en la etiqueta <head> de la página como sea posible:-->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5NBJ37F');</script>
<!-- End Google Tag Manager -->
<!-- Pegue también este código inmediatamente después de la etiqueta <body> de apertura: -->
@nikosantis
nikosantis / new-gtm-santa-elena.html
Created May 25, 2022 16:52
New GTM Santa Elena
<!-- Paste this code as high in the <head> tag of the page as possible: (delete this comment) -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WV4KGJK');</script>
<!-- End Google Tag Manager -->
<!-- Also paste this code immediately after the opening <body> tag: (delete this comment) -->
// use a searchParam for preselect unit
// for example here https://cotizador.saladeventasdigital.com/cotizador/index.php?id_subagrupaciones=22&key=idea&portal=&open_dialog=true&unit=87
// we have 86, 88, 89, 76, 77, 85, 87 and 90 units (modelos)
// we can preselect unit with javascript
var queryStrings = window.location.search;
var params = new URLSearchParams(queryStrings);
var unit = params.get("unit")
if (unit) {
document.getElementById("modelos").value = unit
@nikosantis
nikosantis / dealer_events.html
Last active May 6, 2022 16:32
Dealer events
<!-- add more information to differentiate the dealer and phone type -->
<a
href="javascript:void(0)"
class="mostrar_elemento"
data-show="+56 2 29424282"
data-dealer="DECONTRACT"
data-phoneType="phone"
>Ver teléfono</a
>
<!-- Al inicio del <head> BORRAR ESTE COMENTARIO -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-NBCGJDH');</script>
<!-- End Google Tag Manager -->
Esto va en el head al inicio
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WXCH65G');</script>
<!-- End Google Tag Manager -->
window.onload = function () {
(function () {
var ldk = document.createElement("script");
ldk.type = "text/javascript";
ldk.async = true;
ldk.src =
"https://s.cliengo.com/weboptimizer/60770de300a1d4002a251200/607d886ab7d89e002a9fc6bf.js?platform=view_installation_code";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(ldk, s);
})();
@nikosantis
nikosantis / form-events.js
Last active May 6, 2022 21:10
Events for HD Forms
// with dataLayer object
// use this array push when the submitted form was success
dataLayer.push({
event: "formSent",
formName: "formName", // you can use formName or formId
formEmail: "email from form",
formPhone: "phone from form", // only if the phone is required in the form
formProductName: "product name" // only if have a selected product
});