I am trying to set up a retargeting campaign at the Dutch adcrowd.com. I use a google shopper xml for the product-feed. Adcrowd works with a javascript 'smartpixel'. I put this code in the footer sector (it works) The smartpixel is as follows:
<script type="text/javascript">
var _ac = {};
// _ac.value = '19.99'; // Optioneel: voeg waarde toe aan conversies.
// _ac.order_id = 'ABC123'; // Voeg je eigen order-id toe voor rapportage (optioneel)
_ac.product = '123456'; // Webmaster: vervang op de productpagina 123456 door het product id.
(function(d, t) {
var a = d.createElement(t), s = d.getElementsByTagName(t)[0];
a.async = a.src = '//pixel.adcrowd.com/smartpixel/03b264c595403666634ac75d828439bc.js';
s.parentNode.insertBefore(a, s);
}(document, 'script'));
</script>
My problem is the -ac.product code. What do I place here for an overall dynamic code
Thnx, Henk
you put what ever is easiest for u to identify the product I assume.. perhaps sku or the product id
if not in VM then try
<?php
$jinput = JFactory::getApplication()->input;
$pid = $jinput->get('virtuemart_product_id');
?>
~~~~~~~~~~~~~
_ac.product = '<?php echo $pid; ?>';
but would be simpler in the VM product details template so you have any var u need
Thnx! I tried the simple code. But it did not work :(. I did not try the first code yet. I don't know where to place it.
simple code?
add YOUR code to the product details template .. that's where it should be.. then all the vars are there
_ac.product = '<?php echo $this->product->product_sku; ?>';
With the simpel code I meant adding: _ac.product = '<?php echo $pid; ?>'; to the footer of all pages in my template. Is this the page that I have to change: public_html/components/com_virtuemart/views/productdetails/tmpl/default.php? Where do I place it, and what precisely. Sorry, I am not very good at modifying php files.
Is there somebody who can help me?
you over ride the file you mention.. yes
then
Quoteadd YOUR code to the product details template - anywhere .. that's where it should be.. then all the vars are there
_ac.product = '<?php echo $this->product->product_sku; ?>';
so now u just echo out what every var you want to replace in your JS
and please use the javascript handler of vm http://docs.virtuemart.net/tutorials/development/196-the-vm-javascript-handler.html
You can easily add your desired retrageting/tracking codes using VP Conversion Tracking plugin - https://www.virtueplanet.com/extensions/vp-conversion-tracking
Disclaimer: I am the developer of this plugin.
Thnx for your reaction. If your Plugin solves my problem, I would be really happy and buy it immediately. My problem is that I do not know what to do with the '_ac.productcode'. It seems that there must be a dynamic code. The site is adcrowd.com, the code in my first post. Please confirm that your plugin can do this job!