Skip to content

Instantly share code, notes, and snippets.

@aseredenko
Created June 26, 2018 12:54
Show Gist options
  • Save aseredenko/c0ef3ad82ff05ab19715dfc3f3d2344d to your computer and use it in GitHub Desktop.
Save aseredenko/c0ef3ad82ff05ab19715dfc3f3d2344d to your computer and use it in GitHub Desktop.
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
<script>
var device = '{{ device }}';
const appMP = !!'{{ MP }}';
if (localStorage.getItem("showAbdn") === 'yes' && localStorage.getItem("abdnShown") !== 'yes' && device === 'mobile') {
axios.get('https://services.trackingmax.com/abandonment', {
params: {
site: 'homesecurityhunter.com',
mp: appMP,
zip: localStorage.getItem("zip"),
vid: appJsData.vid,
landing_url: appJsData.landing_url
}
})
.then(function (response) {
if (response.data.mobile_enabled && response.data.mobile_html && response.data.mobile_css) {
localStorage.setItem('abdnShown', 'yes');
$('#abdn-popup').fadeIn();
$('#abdn-popup .abdn-popup-container').html(response.data.mobile_html);
var css = response.data.mobile_css;
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
}
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment