-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version of Marketo integration with Munchkin tracking script.
- Loading branch information
Showing
9 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: marketo | ||
title: Marketo | ||
icon: ./assets/icon.png | ||
description: Use Marketo's automation platform (part of the Adobe Experience Cloud) with your GitBook docs. | ||
previewImages: | ||
- ./assets/marketo-preview.png | ||
externalLinks: | ||
- label: Documentation | ||
url: https://www.gitbook.com/integrations/marketo | ||
visibility: private | ||
organization: gitbook | ||
script: ./src/index.ts | ||
scopes: | ||
- site:script:inject | ||
contentSecurityPolicy: | ||
script-src: | | ||
https://munchkin.marketo.net; | ||
connect-src: | | ||
munchkin.marketo.net | ||
*; | ||
summary: | | ||
# Overview | ||
Marketo Engage is a complete AI-powered marketing automation platform, and part of the Adobe Experience Cloud. This integration provides support for Marketo forms and the Munchkin tracking script. | ||
# How it works | ||
This integration allows you to connect the Munchkin tracking script to your GitBook docs site, and embed Marketo forms in your content. | ||
# Configure | ||
You can enable the integration on single published space by navigating to the sub-navigation and clicking on Integrations button. If you prefer to enable the integration or multiple or all published spaces you can do so by navigating to the org settings and clicking the Integrations tab. You will need your Domain to finish the configuration. | ||
categories: | ||
- analytics | ||
- content | ||
- marketing | ||
configurations: | ||
account: | ||
properties: | ||
account: | ||
type: string | ||
title: Munchkin Account ID | ||
description: Your account ID, found under Admin > Integration > Munchkin menu. | ||
required: | ||
- account | ||
target: all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.raw.js' { | ||
const content: string; | ||
export default content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@gitbook/integration-marketo", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@gitbook/api": "*", | ||
"@gitbook/runtime": "*" | ||
}, | ||
"devDependencies": { | ||
"@gitbook/cli": "workspace:*", | ||
"@gitbook/tsconfig": "workspace:*" | ||
}, | ||
"scripts": { | ||
"typecheck": "tsc --noEmit", | ||
"publish-integrations-staging": "gitbook publish .", | ||
"check": "gitbook check" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
createIntegration, | ||
FetchEventCallback, | ||
FetchPublishScriptEventCallback, | ||
RuntimeContext, | ||
RuntimeEnvironment, | ||
} from '@gitbook/runtime'; | ||
|
||
import script from './marketoMunchkin.raw.js'; | ||
|
||
type MarketoRuntimeContext = RuntimeContext< | ||
RuntimeEnvironment< | ||
{}, | ||
{ | ||
account?: string; | ||
workspace?: string; | ||
} | ||
> | ||
>; | ||
|
||
export const handleFetchEvent: FetchPublishScriptEventCallback = async ( | ||
event, | ||
{ environment }: MarketoRuntimeContext, | ||
) => { | ||
const account = environment.siteInstallation?.configuration?.account; | ||
const workspace = environment.siteInstallation?.configuration?.workspace || ''; | ||
|
||
if (!account) { | ||
return; | ||
} | ||
|
||
return new Response( | ||
(script as string).replace('<account>', account).replace('<workspace>', workspace), | ||
{ | ||
headers: { | ||
'Content-Type': 'application/javascript', | ||
'Cache-Control': 'max-age=604800', | ||
}, | ||
}, | ||
); | ||
}; | ||
|
||
export default createIntegration<MarketoRuntimeContext>({ | ||
fetch_published_script: handleFetchEvent, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// https://experienceleague.adobe.com/en/docs/marketo/using/product-docs/administration/additional-integrations/add-munchkin-tracking-code-to-your-website | ||
(function () { | ||
let didInit = false; | ||
const document = window.document; | ||
const accountId = '<account>'; | ||
const workspace = '<workspace>'; | ||
|
||
function initMunchkin() { | ||
if (didInit === false) { | ||
didInit = true; | ||
Munchkin.init(accountId, workspace.length ? { wsInfo: workspace } : undefined); | ||
} | ||
} | ||
const s = document.createElement('script'); | ||
s.type = 'text/javascript'; | ||
s.async = true; | ||
s.src = '//munchkin.marketo.net/munchkin.js'; | ||
s.onreadystatechange = function () { | ||
if (this.readyState == 'complete' || this.readyState == 'loaded') { | ||
initMunchkin(); | ||
} | ||
}; | ||
s.onload = initMunchkin; | ||
document.getElementsByTagName('head')[0].appendChild(s); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@gitbook/tsconfig/integration.json" | ||
} |