javascript - What would be the best practice implementing Google Adwords Dynamic Remarketing Tag with AngularJS -
i trying dynamically populate google adwords remarketing tag. how google code looks like:
<script type="text/javascript"> var google_tag_params = { dynx_itemid: 'replace_with_value', dynx_itemid2: 'replace_with_value', dynx_pagetype: 'replace_with_value', dynx_totalvalue: 'replace_with_value', }; </script> <script type="text/javascript"> /* <![cdata[ */ var google_conversion_id = {converion-id}; // replace {converion-id} conversion id var google_custom_params = window.google_tag_params; var google_remarketing_only = true; /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <!-- replace {converion-id} conversion id --> <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/{converion-id}/?value=0&guid=on&script=0"/> </div> </noscript>
on each page loaded dynamically replace dynx_itemid variable through angular. love hear thoughts it. i've found following lib https://github.com/mooyoul/angulartics-google-adwords-remarketing-tag supports remarketing tag , not dynamic one.
thanks
eventually ended creating angular module gets 3 parameters conversion label, value , currency , called wherever needed
angular.module('project.google.model', [ /*google remarketing module*/ ]).service('googlemodel', [function () { var model = this; model.trackconversion = function (label, value, currency) { window.google_trackconversion({ google_conversion_id: xxxxxxx, google_conversion_language: "en", google_conversion_format: "3", google_conversion_color: "ffffff", google_conversion_label: label, google_conversion_value: value, google_conversion_currency: currency, google_remarketing_only: false }); } }]);
Comments
Post a Comment