DoubleClick Floodlight 代码和 AngularJS
DoubleClick floodlight tags and AngularJS
我得到了以下要在 angular 应用程序中实施的双击标签。
显然,以下方法不适用于单页应用程序。不知何故,我需要将下面的代码片段翻译成更适合 angular.
的内容
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://xxxxxxx.fls.doubleclick.net/activityi;src=xxxxxxx;type=ret;cat=getaq0;u1=[Equipment Cost];u2=[Equipment Type];u3=[Company Type];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://xxxxxxx.fls.doubleclick.net/activityi;src=xxxxxxx;type=ret;cat=getaq0;u1=[Equipment Cost];u2=[Equipment Type];u3=[Company Type];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
我已经使用工具来实现类似的 google 转换,但是,对于双击我找不到任何东西。
任何人都可以推荐一种工具或方法来实现我所追求的目标 - 例如,我可以简单地取消 iframe 并从 angular 服务调用 src url 吗?
对我有用的是在 Angular 指令中实现此标记,因为代码将在加载时被编译并插入到页面上。我们的营销团队确认它正在运行,他们可以看到命中率。
指令:floodlight-tag.directive.js
(function () {
'use strict';
angular.module('myApp')
.directive('floodlightTag', floodlightDirective);
floodlightDirective.$inject = ['$log'];
function floodlightDirective($log) {
return {
restrict: 'E',
template: '<div style="display: none"><img src="{{ trustedUrl }} " width="1" height="1" alt=""/></div>',
link: floodlightLink
};
function floodlightLink(scope, element, attr) {
var axel = Math.random() + "";
var a = axel * 10000000000000;
scope.trustedUrl = attr.src + a + '?';
}
}
})();
和 HTML:some-page.html(它应该放在模板上而不是 index.html
)
<floodlight-tag src="[your_floodlight_url]"></floodlight-tag>
我还没有弄清楚的一件事是,当您希望这些标签绑定到一个按钮(即点击时)时,如何让它工作。我目前正在研究解决方案。看看我在下面做了什么来解决第一个问题。
希望对您有所帮助!
我得到了以下要在 angular 应用程序中实施的双击标签。
显然,以下方法不适用于单页应用程序。不知何故,我需要将下面的代码片段翻译成更适合 angular.
的内容<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<iframe src="https://xxxxxxx.fls.doubleclick.net/activityi;src=xxxxxxx;type=ret;cat=getaq0;u1=[Equipment Cost];u2=[Equipment Type];u3=[Company Type];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=' + a + '?" width="1" height="1" frameborder="0" style="display:none"></iframe>');
</script>
<noscript>
<iframe src="https://xxxxxxx.fls.doubleclick.net/activityi;src=xxxxxxx;type=ret;cat=getaq0;u1=[Equipment Cost];u2=[Equipment Type];u3=[Company Type];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;ord=1?" width="1" height="1" frameborder="0" style="display:none"></iframe>
</noscript>
我已经使用工具来实现类似的 google 转换,但是,对于双击我找不到任何东西。
任何人都可以推荐一种工具或方法来实现我所追求的目标 - 例如,我可以简单地取消 iframe 并从 angular 服务调用 src url 吗?
对我有用的是在 Angular 指令中实现此标记,因为代码将在加载时被编译并插入到页面上。我们的营销团队确认它正在运行,他们可以看到命中率。
指令:floodlight-tag.directive.js
(function () {
'use strict';
angular.module('myApp')
.directive('floodlightTag', floodlightDirective);
floodlightDirective.$inject = ['$log'];
function floodlightDirective($log) {
return {
restrict: 'E',
template: '<div style="display: none"><img src="{{ trustedUrl }} " width="1" height="1" alt=""/></div>',
link: floodlightLink
};
function floodlightLink(scope, element, attr) {
var axel = Math.random() + "";
var a = axel * 10000000000000;
scope.trustedUrl = attr.src + a + '?';
}
}
})();
和 HTML:some-page.html(它应该放在模板上而不是 index.html
)
<floodlight-tag src="[your_floodlight_url]"></floodlight-tag>
我还没有弄清楚的一件事是,当您希望这些标签绑定到一个按钮(即点击时)时,如何让它工作。我目前正在研究解决方案。看看我在下面做了什么来解决第一个问题。
希望对您有所帮助!