Last active
October 20, 2017 13:58
-
-
Save chhib/cac4fba36c886bb158741c1694457c93 to your computer and use it in GitHub Desktop.
Keyword Provider Google Analytics plugin method to override campaign keyword
This file contains hidden or 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
function () { | |
return function(model) { | |
if ({{Provided Keyword}}) { | |
model.set('campaignKeyword', {{Provided Keyword}}); | |
model.set('campaignContent', {{Provided Position}}); | |
model.set('campaignSource', 'google'); | |
model.set('campaignMedium', 'organic'); | |
model.set('campaignName', 'Roy App Keyword Provider'); | |
} | |
} | |
} |
This file contains hidden or 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
<!-- Google Analytics Snippet --> | |
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-1234-5', 'auto'); | |
// Add this before the send pageview call | |
ga('require', 'RoyAppKeywordProvider'); | |
ga('send', 'pageview'); | |
</script> |
This file contains hidden or 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
<!-- Google Analytics Snippet --> | |
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-1234-5', 'auto'); | |
ga('send', 'pageview'); | |
</script> |
This file contains hidden or 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
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', { | |
trackingId: {{Tracking ID}}, | |
name: {{Tracker Name}} | |
}); | |
ga({{Tracker Name}} + '.require', 'RoyAppKeywordProvider'); | |
(function (window) { | |
window['RoyAppKeywordProviderConfig'] = { | |
accountId: {{Keyword Provider Account ID}} | |
}; | |
var s = window.document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.src = '//cdn.royapp.com/kp.js'; | |
var x = window.document.getElementsByTagName('script')[0]; | |
x.parentNode.insertBefore(s, x); | |
}(window)); | |
</script> |
This file contains hidden or 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
<!-- Roy App Keyword Provider snippet --> | |
<script> | |
(function (window) { | |
window['RoyAppKeywordProviderConfig'] = { | |
// Replace with your own Account ID | |
accountId: 'fe54f7248b354846b080cea1011233aa', | |
mode: 'dataLayer', | |
dataLayer: { | |
event: 'All Pages with Keyword Provider', | |
name: 'dataLayer', | |
alwaysPush: true | |
} | |
}; | |
var s = window.document.createElement('script'); s.type = 'text/javascript'; s.async = true; | |
s.src = '//cdn.royapp.com/kp.js'; var x = window.document.getElementsByTagName('script')[0]; | |
x.parentNode.insertBefore(s, x); | |
}(window)); | |
</script> |
This file contains hidden or 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
<!-- Roy App Keyword Provider snippet --> | |
<script> | |
(function (window) { | |
window['RoyAppKeywordProviderConfig'] = { | |
// Replace with your own Account ID | |
accountId: 'da967f53ae524ff98464a39c43d3a8gg' | |
}; | |
var s = window.document.createElement('script'); | |
s.type = 'text/javascript'; | |
s.async = true; | |
s.src = '//cdn.royapp.com/kp.js'; | |
var x = window.document.getElementsByTagName('script')[0]; | |
x.parentNode.insertBefore(s, x); | |
}(window)); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment