News:

Support the VirtueMart project and become a member

Main Menu

Retargeting javascript code

Started by Scincus, August 18, 2016, 21:10:24 PM

Previous topic - Next topic

Scincus

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

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Scincus

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.

GJC Web Design

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; ?>';
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Scincus

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.

Scincus

Is there somebody who can help me?

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Jumbo!

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.

Scincus

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!