Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions integrations/marketo-v2/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
4.0.2 / 2021-10-26
=================

* Add better error handling for when Marketo scripts are blocked

4.0.0 / 2021-09-09
=================

Expand Down
17 changes: 17 additions & 0 deletions integrations/marketo-v2/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ Marketo.prototype.initialize = function() {

var self = this;
this.load(function() {
if (window.Munchkin === undefined) {
return;
}

window.Munchkin.init(munchkinId, {
asyncOnly: true
});
Expand All @@ -146,6 +150,10 @@ Marketo.prototype.initialize = function() {
});

this.load('forms', { marketoHostUrl: marketoHostUrl }, function() {
if (window.MktoForms2 === undefined) {
return;
}

var marketoForm = document.createElement('form');
marketoForm.setAttribute('id', 'mktoForm_' + marketoFormId);
marketoForm.setAttribute('style', 'display:none');
Expand Down Expand Up @@ -185,6 +193,11 @@ Marketo.prototype.page = function(page) {

var properties = page.properties();
var parsed = url.parse(properties.url);

if (window.mktoMunchkinFunction === undefined) {
return;
}

window.mktoMunchkinFunction('visitWebPage', {
url: properties.url,
params: parsed.query
Expand Down Expand Up @@ -273,6 +286,10 @@ Marketo.prototype.identify = function(identify) {
}
}, settings.traits);

if (window.MktoForms2 === undefined) {
return;
}

window.MktoForms2.whenReady(function(form) {
var marketoFormId = parseInt(settings.marketoFormId, 10);
var validFormId = !(Number.isNaN(marketoFormId) || marketoFormId <= 0);
Expand Down
2 changes: 1 addition & 1 deletion integrations/marketo-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@segment/analytics.js-integration-marketo-v2",
"description": "The Marketo analytics.js integration.",
"version": "4.0.1",
"version": "4.0.2",
"keywords": [
"analytics.js",
"analytics.js-integration",
Expand Down